|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.odejava.Body
public class Body
Representation of a body that can be used in a rigid body simulation. A rigid body has various properties from the point of view of the simulation. Some properties change over time:
Position vector (x,y,z) of the body's point of reference. Currently the point of reference must correspond to the body's center of mass. Linear velocity of the point of reference, a vector (vx,vy,vz). Orientation of a body, represented by a quaternion (qs,qx,qy,qz) or a 3x3 rotation matrix. Angular velocity vector (wx,wy,wz) which describes how the orientation changes over time.
Other body properties are usually constant over time:
Mass of the body. Position of the center of mass with respect to the point of reference. In the current implementation the center of mass and the point of reference must coincide. Inertia matrix. This is a 3x3 matrix that describes how the body's mass is distributed around the center of mass.
Conceptually each body has an x-y-z coordinate frame embedded in it, that moves and rotates with the body:
The origin of this coordinate frame is the body's point of reference. Some values in ODE (vectors, matrices etc) are relative to the body coordinate frame, and others are relative to the global coordinate frame.
Note that the shape of a rigid body is not a dynamic property (except insofar as it influences the various mass properties). It is only collision detection that cares about the detailed shape of the body.
Unimplemented
| Constructor Summary | |
|---|---|
Body(String name,
World world)
Create a named body that belongs to the given world, and does not contain any geometry. |
|
Body(String name,
World world,
PlaceableGeom geom)
Create a named ODE body with an initial geometry. |
|
Body(World world)
Create an unnamed body that belongs to the given world, and does not contain any geometry. |
|
| Method Summary | |
|---|---|
void |
addCollisionGeom(PlaceableGeom geom)
Adds collision geometry to this body, unlike addGeom, this does not touch the mass parameters |
void |
addForce(float x,
float y,
float z)
|
void |
addForce(org.openmali.vecmath2.Vector3f force)
Convienience method, just calls addForce(x,y,z) |
void |
addForceAtPos(float fx,
float fy,
float fz,
float px,
float py,
float pz)
|
void |
addForceAtRelPos(float fx,
float fy,
float fz,
float px,
float py,
float pz)
|
void |
addGeom(PlaceableGeom geom)
Adds a geom to this body and sets the default mass for this geom An exception will be thrown if the geom is already in this body. |
void |
addRelForce(float fx,
float fy,
float fz)
|
void |
addRelForceAtPos(float fx,
float fy,
float fz,
float px,
float py,
float pz)
|
void |
addRelForceAtRelPos(float fx,
float fy,
float fz,
float px,
float py,
float pz)
|
void |
addRelTorque(float x,
float y,
float z)
|
void |
addRelTorque(org.openmali.vecmath2.Vector3f torque)
Convenience method, just calls addRelTorque(x,y,z) |
void |
addTorque(float x,
float y,
float z)
|
void |
addTorque(org.openmali.vecmath2.Vector3f torque)
Convenience method, just calls addTorque(x,y,z) |
void |
adjustMass(float mass)
|
protected void |
delete()
Deletes the body. |
void |
deleteFromWorld()
Removes this Body from its World and deletes it. |
boolean |
fixed()
Returns true if this Placeable is dynamic and false if it is static. |
org.openmali.vecmath2.Vector3f |
getAngularVel()
Get the angular velocity of the body. |
void |
getAngularVel(float[] result)
Get the angular velocity of the body and place it in the user-provided array. |
org.openmali.vecmath2.Vector3f |
getAngularVel(org.openmali.vecmath2.Vector3f result)
Get the angular velocity for the body and place it in the user-provided data structure. |
float |
getAngularVelocityDisableThreshold()
Get the threshold for angular velocity at which a body will be automatically disabled. |
org.openmali.vecmath2.AxisAngle3f |
getAxisAngle()
Get the rotation expressed as a axis/angle pair for the body. |
org.openmali.vecmath2.AxisAngle3f |
getAxisAngle(org.openmali.vecmath2.AxisAngle3f result)
Get the rotation expressed as a axis/angle for the body and place it in the user-provided data structure. |
org.odejava.ode.SWIGTYPE_p_dBodyID |
getBodyId()
Returns the SWIG representation of this body identifier. |
org.openmali.vecmath2.Vector3f |
getCenterOfMass()
Get the center of mass of this Body. |
org.openmali.vecmath2.Vector3f |
getCenterOfMass(org.openmali.vecmath2.Vector3f v)
Get the center of mass of this Body. |
World |
getContainingWorld()
Returns the world that contains this Body. |
org.odejava.ode.dMass |
getdMass()
Get the dMass of this Body |
org.openmali.vecmath2.Vector3f |
getFiniteRotationAxis()
Get the finiteRotationAxis of the body. |
void |
getFiniteRotationAxis(float[] result)
Get the finiteRotationAxis of the body and place it in the user-provided array. |
org.openmali.vecmath2.Vector3f |
getFiniteRotationAxis(org.openmali.vecmath2.Vector3f result)
Get the finiteRotationAxis for the body and place it in the user-provided data structure. |
int |
getFiniteRotationMode()
|
org.openmali.vecmath2.Vector3f |
getForce()
Get the force of the body. |
void |
getForce(float[] result)
Get the force of the body and place it in the user-provided array. |
org.openmali.vecmath2.Vector3f |
getForce(org.openmali.vecmath2.Vector3f result)
Get the force for the body and place it in the user-provided data structure. |
Geom |
getGeom()
Returns the last added geom |
List<Geom> |
getGeoms()
Returns a list of geoms |
int |
getGravityMode()
Get the current mode describing how global gravity will effect this body. |
org.odejava.ode.SWIGTYPE_p_dBodyID |
getId()
|
org.openmali.vecmath2.Matrix3f |
getInertialTensor()
Get the inertial tensor of this Body. |
org.openmali.vecmath2.Matrix3f |
getInertiaTensor(org.openmali.vecmath2.Matrix3f m)
Get the inertia tensor of this Body. |
List<org.odejava.ode.SWIGTYPE_p_dJointID> |
getJoints()
Return a list of joints attached to this body, or null if none. |
List<org.odejava.ode.SWIGTYPE_p_dJointID> |
getJoints(List<org.odejava.ode.SWIGTYPE_p_dJointID> result)
Return a list of joints attached to this body, copying them into the given list. |
org.openmali.vecmath2.Vector3f |
getLinearVel()
Get the linear velocity of the body. |
void |
getLinearVel(float[] result)
Get the linear velocity of the body and place it in the user-provided array. |
org.openmali.vecmath2.Vector3f |
getLinearVel(org.openmali.vecmath2.Vector3f result)
Get the linear velocity for the body and place it in the user-provided data structure. |
float |
getLinearVelocityDisableThreshold()
Get the threshold for linear velocity at which a body will be automatically disabled. |
float |
getMass()
Get the mass of this Body. |
String |
getName()
Fet the currently associated name string. |
int |
getNumOfJoints()
Return number of joints attached to this body. |
void |
getPointVel(float x,
float y,
float z,
float[] result)
Gets the velocity of a point on the body |
org.openmali.vecmath2.Tuple3f |
getPosition()
Get the location in world space of the body. |
void |
getPosition(float[] result)
Get the position of the body and place it in the user-provided array. |
org.openmali.vecmath2.Tuple3f |
getPosition(org.openmali.vecmath2.Tuple3f result)
Get the position of the body and place it in the user-provided data structure. |
org.openmali.vecmath2.Quaternion4f |
getQuaternion()
Get the rotation expressed as a quaternion for the body. |
void |
getQuaternion(float[] result)
Get the rotation of the body expressed as a quaternion and place it in the user-provided array. |
org.openmali.vecmath2.Quaternion4f |
getQuaternion(org.openmali.vecmath2.Quaternion4f result)
Get the rotation expressed as a quaternion for the body and place it in the user-provided data structure. |
void |
getQuatWXYZ(float[] result)
Get the rotation of the body expressed as a quaternion and place it in the user-provided array. |
void |
getRelPointPos(float x,
float y,
float z,
float[] result)
Returns the relative body position x,y,z in world coordinates |
void |
getRelPointVel(float x,
float y,
float z,
float[] result)
Gets the relative velocity of a point on the body |
org.openmali.vecmath2.Matrix3f |
getRotation()
Get the rotation matrix for the body. |
void |
getRotation(float[] result)
Get the rotation of the body expressed as a 3x3 matrix and place it in the user-provided array. |
org.openmali.vecmath2.Matrix3f |
getRotation(org.openmali.vecmath2.Matrix3f result)
Get the rotation matrix for the body and place it in the user-provided data structure. |
int |
getStepDisableThreshold()
Get the threshold for the number of steps at which a body will be automatically disabled. |
float |
getTimeDisableThreshold()
Get the threshold for the evaluation time at which a body will be automatically disabled. |
org.openmali.vecmath2.Vector3f |
getTorque()
Get the torque of the body. |
void |
getTorque(float[] result)
Get the torque of the body and place it in the user-provided array. |
org.openmali.vecmath2.Vector3f |
getTorque(org.openmali.vecmath2.Vector3f result)
Get the torque for the body and place it in the user-provided data structure. |
Object |
getUserData()
|
boolean |
isAutoDisabling()
Check to see the current state of the auto disable functionality. |
boolean |
isEnabled()
|
void |
removeGeom(PlaceableGeom geom)
Removes a geom from this body. |
void |
resetRotationAndForces()
|
void |
setAngularVel(float x,
float y,
float z)
Set the angular velocity to a new value, using individual values. |
void |
setAngularVel(org.openmali.vecmath2.Vector3f angularVel)
Set the angular velocity to a new value, using a vector. |
void |
setAngularVelocityDisableThreshold(float vel)
Set the threshold for the angular velocity that will cause a body to be disabled. |
void |
setAutoDisable(boolean state)
Control whether the world should allow auto-disable of this body. |
void |
setAxisAndAngle(org.openmali.vecmath2.AxisAngle3f axisAngle)
Sets the rotation using the given axis and angle. |
void |
setAxisAndAngle(float ax,
float ay,
float az,
float angle)
|
void |
setBoxMass(float density,
float lx,
float ly,
float lz)
Set the inertial parameters of this body based on box density and dimensions. |
void |
setBoxMassTotal(float mass,
float lx,
float ly,
float lz)
Set the inertial parameters of this body based on box mass and dimensions. |
void |
setDefaultMass(Geom geom)
Set default mass parameters based on geometry. |
void |
setEnabled(boolean enabled)
|
void |
setFiniteRotationAxis(float x,
float y,
float z)
Set the finiteRotationAxis to a new value, using individual values. |
void |
setFiniteRotationAxis(org.openmali.vecmath2.Vector3f finiteRotationAxis)
Set the finiteRotationAxis to a new value, using a vector. |
void |
setFiniteRotationMode(int mode)
|
void |
setForce(float x,
float y,
float z)
Set the force to a new value, using individual values. |
void |
setForce(org.openmali.vecmath2.Vector3f force)
Set the force to a new value, using a vector. |
void |
setGeom(PlaceableGeom geom)
Adds a geom to this body. |
void |
setGravityMode(int mode)
Change the mode of how gravity effects this geometry. |
void |
setId(org.odejava.ode.SWIGTYPE_p_dBodyID bodyId)
|
void |
setLinearVel(float x,
float y,
float z)
Set the linear velocity to a new value, using individual values. |
void |
setLinearVel(org.openmali.vecmath2.Vector3f linearVel)
Set the linear velocity to a new value, using a vector. |
void |
setLinearVelocityDisableThreshold(float vel)
Set the threshold for the linear velocity that will cause a body to be disabled. |
void |
setMass(Mass m)
Set the mass |
void |
setMassParameters(float themass,
float cgx,
float cgy,
float cgz,
float I11,
float I22,
float I33,
float I12,
float I13,
float I23)
Set the mass parameters to the given values. themass is the mass of the body. |
void |
setName(String n)
Set a new name string to associate with this body. |
void |
setPosition(float x,
float y,
float z)
Set the force to a new value, using individual values. |
void |
setPosition(org.openmali.vecmath2.Tuple3f position)
Set the position to a new value, using a vector. |
void |
setQuaternion(org.openmali.vecmath2.Quaternion4f quaternion)
Sets the quaternion. |
void |
setQuatWXYZ(float w,
float x,
float y,
float z)
|
void |
setRotation(org.openmali.vecmath2.Matrix3f r)
Use of setQuaternion is preferred instead of setRotation as this method might have some problems in some cases. |
void |
setSphereMass(float density,
float radius)
Set the inertial parameters of this body based on sphere density and dimensions. |
void |
setSphereMassTotal(float mass,
float radius)
Set the inertial parameters of this body based on box mass and dimensions. |
void |
setStepDisableThreshold(int steps)
Set the number of evaluation steps before an umoving body is disabled. |
void |
setTimeDisableThreshold(float time)
Set the total amount of evaluation time an umoving body is disabled. |
void |
setTorque(float x,
float y,
float z)
Set the torque to a new value, using individual values. |
void |
setTorque(org.openmali.vecmath2.Vector3f torque)
Set the torque to a new value, using a vector. |
void |
setUserData(Object userData)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Body(World world)
world - The parent world reference
NullPointerException - The world reference was not null
public Body(String name,
World world)
world - The parent world referencename - A name string to associate with this body
NullPointerException - The world reference was not null
public Body(String name,
World world,
PlaceableGeom geom)
world - The parent world referencename - A name string to associate with this bodygeom - An initial geometry to associate with the body
NullPointerException - The world reference was not null| Method Detail |
|---|
public void setGeom(PlaceableGeom geom)
public void addCollisionGeom(PlaceableGeom geom)
geom - public void addGeom(PlaceableGeom geom)
public void removeGeom(PlaceableGeom geom)
public Geom getGeom()
public List<Geom> getGeoms()
public void setDefaultMass(Geom geom)
public void setMass(Mass m)
public void setBoxMass(float density,
float lx,
float ly,
float lz)
public void setBoxMassTotal(float mass,
float lx,
float ly,
float lz)
public void setSphereMass(float density,
float radius)
public void setSphereMassTotal(float mass,
float radius)
public void adjustMass(float mass)
public void resetRotationAndForces()
public void getPosition(float[] result)
result - An object to place the values intopublic org.openmali.vecmath2.Tuple3f getPosition()
getPosition(null).
getPosition in interface Placeablepublic org.openmali.vecmath2.Tuple3f getPosition(org.openmali.vecmath2.Tuple3f result)
getPosition in interface Placeableresult - An object to place the values into or null
public void setPosition(org.openmali.vecmath2.Tuple3f position)
setPosition in interface Placeableposition - A vector holding the position
public void setPosition(float x,
float y,
float z)
setPosition in interface Placeablex - The x component of the the positiony - The y component of the the positionz - The z component of the the positionpublic org.openmali.vecmath2.AxisAngle3f getAxisAngle()
getAxisAngle(null).
getAxisAngle in interface Placeablepublic org.openmali.vecmath2.AxisAngle3f getAxisAngle(org.openmali.vecmath2.AxisAngle3f result)
getAxisAngle in interface Placeableresult - An object to place the values into or null
public void setAxisAndAngle(org.openmali.vecmath2.AxisAngle3f axisAngle)
Placeable
setAxisAndAngle in interface PlaceableaxisAngle - the axis and angle.
public void setAxisAndAngle(float ax,
float ay,
float az,
float angle)
public org.openmali.vecmath2.Quaternion4f getQuaternion()
getQuaternion(null).
getQuaternion in interface Placeablepublic org.openmali.vecmath2.Quaternion4f getQuaternion(org.openmali.vecmath2.Quaternion4f result)
getQuaternion in interface Placeableresult - An object to place the values into or null
public void setQuaternion(org.openmali.vecmath2.Quaternion4f quaternion)
Placeable
setQuaternion in interface Placeablequaternion - the quaternionpublic void getQuaternion(float[] result)
result - An object to place the values intopublic org.openmali.vecmath2.Matrix3f getRotation()
getMatrix(null).
getRotation in interface Placeablepublic org.openmali.vecmath2.Matrix3f getRotation(org.openmali.vecmath2.Matrix3f result)
result - An object to place the values into or null
public void getRotation(float[] result)
result - An object to place the values intopublic void setRotation(org.openmali.vecmath2.Matrix3f r)
setRotation in interface Placeabler - public float getMass()
public org.odejava.ode.dMass getdMass()
public org.openmali.vecmath2.Vector3f getCenterOfMass(org.openmali.vecmath2.Vector3f v)
public org.openmali.vecmath2.Vector3f getCenterOfMass()
public org.openmali.vecmath2.Matrix3f getInertiaTensor(org.openmali.vecmath2.Matrix3f m)
public org.openmali.vecmath2.Matrix3f getInertialTensor()
public int getGravityMode()
public void setGravityMode(int mode)
mode - A value of 1 for global gravity, 0 for no gravitypublic void setEnabled(boolean enabled)
public boolean isEnabled()
public void addForce(float x,
float y,
float z)
public final void addForce(org.openmali.vecmath2.Vector3f force)
force -
public void addForceAtPos(float fx,
float fy,
float fz,
float px,
float py,
float pz)
public void addForceAtRelPos(float fx,
float fy,
float fz,
float px,
float py,
float pz)
public void addRelForce(float fx,
float fy,
float fz)
public void addRelForceAtPos(float fx,
float fy,
float fz,
float px,
float py,
float pz)
public void addRelForceAtRelPos(float fx,
float fy,
float fz,
float px,
float py,
float pz)
public void addTorque(float x,
float y,
float z)
public void getRelPointPos(float x,
float y,
float z,
float[] result)
public void getPointVel(float x,
float y,
float z,
float[] result)
public void getRelPointVel(float x,
float y,
float z,
float[] result)
public final void addTorque(org.openmali.vecmath2.Vector3f torque)
torque -
public void addRelTorque(float x,
float y,
float z)
public final void addRelTorque(org.openmali.vecmath2.Vector3f torque)
torque - public int getNumOfJoints()
public List<org.odejava.ode.SWIGTYPE_p_dJointID> getJoints()
public List<org.odejava.ode.SWIGTYPE_p_dJointID> getJoints(List<org.odejava.ode.SWIGTYPE_p_dJointID> result)
result - A list to put the joints into
public org.odejava.ode.SWIGTYPE_p_dBodyID getId()
public void setId(org.odejava.ode.SWIGTYPE_p_dBodyID bodyId)
bodyId - The bodyId to set.public String getName()
getName in interface Placeablepublic void setName(String n)
n - The new name string to set.protected void delete()
World.deleteBody(Body)
dBodyDestroy - destroys the body |
public void deleteFromWorld()
public World getContainingWorld()
public final void setForce(org.openmali.vecmath2.Vector3f force)
force - A vector holding the force
public void setForce(float x,
float y,
float z)
x - The x component of the the forcey - The y component of the the forcez - The z component of the the forcepublic org.openmali.vecmath2.Vector3f getForce()
getForce(null).
public org.openmali.vecmath2.Vector3f getForce(org.openmali.vecmath2.Vector3f result)
result - An object to place the values into or null
public void getForce(float[] result)
result - An object to place the values intopublic final void setAngularVel(org.openmali.vecmath2.Vector3f angularVel)
angularVel - A vector holding the angular velocity
public void setAngularVel(float x,
float y,
float z)
x - The x component of the the angular velocityy - The y component of the the angular velocityz - The z component of the the angular velocitypublic org.openmali.vecmath2.Vector3f getAngularVel()
getAngularVel(null).
public org.openmali.vecmath2.Vector3f getAngularVel(org.openmali.vecmath2.Vector3f result)
result - An object to place the values into or null
public void getAngularVel(float[] result)
result - An object to place the values intopublic final void setLinearVel(org.openmali.vecmath2.Vector3f linearVel)
linearVel - A vector holding the linear velocity
public void setLinearVel(float x,
float y,
float z)
x - The x component of the the linear velocityy - The y component of the the linear velocityz - The z component of the the linear velocitypublic org.openmali.vecmath2.Vector3f getLinearVel()
getLinearVel(null).
public org.openmali.vecmath2.Vector3f getLinearVel(org.openmali.vecmath2.Vector3f result)
result - An object to place the values into or null
public void getLinearVel(float[] result)
result - An object to place the values intopublic final void setTorque(org.openmali.vecmath2.Vector3f torque)
torque - A vector holding the torque
public void setTorque(float x,
float y,
float z)
x - The x component of the the torquey - The y component of the the torquez - The z component of the the torquepublic org.openmali.vecmath2.Vector3f getTorque()
getTorque(null).
public org.openmali.vecmath2.Vector3f getTorque(org.openmali.vecmath2.Vector3f result)
result - An object to place the values into or null
public void getTorque(float[] result)
result - An object to place the values intopublic final void setFiniteRotationAxis(org.openmali.vecmath2.Vector3f finiteRotationAxis)
finiteRotationAxis - A vector holding the finiteRotationAxis
public void setFiniteRotationAxis(float x,
float y,
float z)
x - The x component of the the rotation axisy - The y component of the the rotation axisz - The z component of the the rotation axispublic org.openmali.vecmath2.Vector3f getFiniteRotationAxis()
getFiniteRotationAxis(null).
public org.openmali.vecmath2.Vector3f getFiniteRotationAxis(org.openmali.vecmath2.Vector3f result)
result - An object to place the values into or null
public void getFiniteRotationAxis(float[] result)
result - An object to place the values intopublic void setFiniteRotationMode(int mode)
public int getFiniteRotationMode()
public org.odejava.ode.SWIGTYPE_p_dBodyID getBodyId()
Returns the SWIG representation of this body identifier.
UNSUPPORTED - use of this method is better avoided. No guarantees are made that this method won't change or even exist in future versions.
public void setMassParameters(float themass,
float cgx,
float cgy,
float cgz,
float I11,
float I22,
float I33,
float I12,
float I13,
float I23)
[ I11 I12 I13 ]
[ I12 I22 I23 ]
[ I13 I23 I33 ]
themass - cgx - cgy - cgz - I11 - I22 - I33 - I12 - I13 - I23 - public boolean fixed()
Placeable
fixed in interface Placeablepublic Object getUserData()
public void setUserData(Object userData)
userData - The userData to set.public void setAutoDisable(boolean state)
state - True to enable auto disabling, false to disablepublic boolean isAutoDisabling()
public void setLinearVelocityDisableThreshold(float vel)
vel - The speed below which the body is disabledpublic float getLinearVelocityDisableThreshold()
public void setAngularVelocityDisableThreshold(float vel)
vel - The speed below which the body is disabledpublic float getAngularVelocityDisableThreshold()
public void setStepDisableThreshold(int steps)
steps - The number of evaluation steps to use or negative to disablepublic int getStepDisableThreshold()
public void setTimeDisableThreshold(float time)
time - The amount of time in seconds or negative to disablepublic float getTimeDisableThreshold()
public void setQuatWXYZ(float w,
float x,
float y,
float z)
public void getQuatWXYZ(float[] result)
result - An object to place the values into, order: w,x,y,z
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||