org.odejava
Class Body

java.lang.Object
  extended by org.odejava.Body
All Implemented Interfaces:
Placeable

public class Body
extends Object
implements Placeable

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

Created 16.12.2003 (dd.mm.yyyy)

Author:
Jani Laakso E-mail: jani.laakso@itmill.com, William Denniss see http://odejava.dev.java.net

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

Body

public Body(World world)
Create an unnamed body that belongs to the given world, and does not contain any geometry. The world reference must be non-null.

Parameters:
world - The parent world reference
Throws:
NullPointerException - The world reference was not null

Body

public Body(String name,
            World world)
Create a named body that belongs to the given world, and does not contain any geometry. The world reference must be non-null and the name string is optional.

Parameters:
world - The parent world reference
name - A name string to associate with this body
Throws:
NullPointerException - The world reference was not null

Body

public Body(String name,
            World world,
            PlaceableGeom geom)
Create a named ODE body with an initial geometry. The body's default mass is based on geometry. Unnamed geoms are named after their body's name.

Parameters:
world - The parent world reference
name - A name string to associate with this body
geom - An initial geometry to associate with the body
Throws:
NullPointerException - The world reference was not null
Method Detail

setGeom

public void setGeom(PlaceableGeom geom)
Adds a geom to this body. Alias for addGeom.


addCollisionGeom

public void addCollisionGeom(PlaceableGeom geom)
Adds collision geometry to this body, unlike addGeom, this does not touch the mass parameters

Parameters:
geom -

addGeom

public 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.


removeGeom

public void removeGeom(PlaceableGeom geom)
Removes a geom from this body. An exception will be thrown if the geom isn't in the body to begin with.


getGeom

public Geom getGeom()
Returns the last added geom

Returns:
the last added geom

getGeoms

public List<Geom> getGeoms()
Returns a list of geoms


setDefaultMass

public void setDefaultMass(Geom geom)
Set default mass parameters based on geometry. Density is DEFAULT_MASS_DENSITY.


setMass

public void setMass(Mass m)
Set the mass


setBoxMass

public void setBoxMass(float density,
                       float lx,
                       float ly,
                       float lz)
Set the inertial parameters of this body based on box density and dimensions.


setBoxMassTotal

public void setBoxMassTotal(float mass,
                            float lx,
                            float ly,
                            float lz)
Set the inertial parameters of this body based on box mass and dimensions.


setSphereMass

public void setSphereMass(float density,
                          float radius)
Set the inertial parameters of this body based on sphere density and dimensions.


setSphereMassTotal

public void setSphereMassTotal(float mass,
                               float radius)
Set the inertial parameters of this body based on box mass and dimensions.


adjustMass

public void adjustMass(float mass)

resetRotationAndForces

public void resetRotationAndForces()

getPosition

public void getPosition(float[] result)
Get the position of the body and place it in the user-provided array.

Parameters:
result - An object to place the values into

getPosition

public org.openmali.vecmath2.Tuple3f getPosition()
Get the location in world space of the body. A new Vector3f instance will be created for each request. This is identical to calling getPosition(null).

Specified by:
getPosition in interface Placeable
Returns:
A new vector object containing the position values

getPosition

public 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. If the user-provided data structure is null, then a new instance is created and returned, otherwise the user provided structure is used as the return value.

Specified by:
getPosition in interface Placeable
Parameters:
result - An object to place the values into or null
Returns:
Either the result parameter or a new object

setPosition

public void setPosition(org.openmali.vecmath2.Tuple3f position)
Set the position to a new value, using a vector.

Specified by:
setPosition in interface Placeable
Parameters:
position - A vector holding the position

setPosition

public void setPosition(float x,
                        float y,
                        float z)
Set the force to a new value, using individual values.

Specified by:
setPosition in interface Placeable
Parameters:
x - The x component of the the position
y - The y component of the the position
z - The z component of the the position

getAxisAngle

public org.openmali.vecmath2.AxisAngle3f getAxisAngle()
Get the rotation expressed as a axis/angle pair for the body. A new AxisAngle3f instance will be created for each request. This is identical to calling getAxisAngle(null).

Specified by:
getAxisAngle in interface Placeable
Returns:
A new quaternion object containing the axis values

getAxisAngle

public 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. If the user-provided data structure is null, then a new instance is created and returned, otherwise the user provided structure is used as the return value.

Specified by:
getAxisAngle in interface Placeable
Parameters:
result - An object to place the values into or null
Returns:
Either the result parameter or a new object

setAxisAndAngle

public void setAxisAndAngle(org.openmali.vecmath2.AxisAngle3f axisAngle)
Description copied from interface: Placeable
Sets the rotation using the given axis and angle.

Specified by:
setAxisAndAngle in interface Placeable
Parameters:
axisAngle - the axis and angle.

setAxisAndAngle

public void setAxisAndAngle(float ax,
                            float ay,
                            float az,
                            float angle)

getQuaternion

public org.openmali.vecmath2.Quaternion4f getQuaternion()
Get the rotation expressed as a quaternion for the body. A new Quaternion4f instance will be created for each request. This is identical to calling getQuaternion(null).

Specified by:
getQuaternion in interface Placeable
Returns:
A new quaternion object containing the axis values

getQuaternion

public 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. If the user-provided data structure is null, then a new instance is created and returned, otherwise the user provided structure is used as the return value.

Specified by:
getQuaternion in interface Placeable
Parameters:
result - An object to place the values into or null
Returns:
Either the result parameter or a new object

setQuaternion

public void setQuaternion(org.openmali.vecmath2.Quaternion4f quaternion)
Description copied from interface: Placeable
Sets the quaternion.

Specified by:
setQuaternion in interface Placeable
Parameters:
quaternion - the quaternion

getQuaternion

public void getQuaternion(float[] result)
Get the rotation of the body expressed as a quaternion and place it in the user-provided array.

Parameters:
result - An object to place the values into

getRotation

public org.openmali.vecmath2.Matrix3f getRotation()
Get the rotation matrix for the body. A new matrix instance will be created for each request. This is identical to calling getMatrix(null).

Specified by:
getRotation in interface Placeable
Returns:
A new matrix object containing the axis values

getRotation

public 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. If the user-provided data structure is null, then a new instance is created and returned, otherwise the user provided structure is used as the return value.

Parameters:
result - An object to place the values into or null
Returns:
Either the result parameter or a new object

getRotation

public void getRotation(float[] result)
Get the rotation of the body expressed as a 3x3 matrix and place it in the user-provided array. The array must be of length 9 and is row-major.

Parameters:
result - An object to place the values into

setRotation

public 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.

Specified by:
setRotation in interface Placeable
Parameters:
r -

getMass

public float getMass()
Get the mass of this Body.


getdMass

public org.odejava.ode.dMass getdMass()
Get the dMass of this Body


getCenterOfMass

public org.openmali.vecmath2.Vector3f getCenterOfMass(org.openmali.vecmath2.Vector3f v)
Get the center of mass of this Body.


getCenterOfMass

public org.openmali.vecmath2.Vector3f getCenterOfMass()
Get the center of mass of this Body.


getInertiaTensor

public org.openmali.vecmath2.Matrix3f getInertiaTensor(org.openmali.vecmath2.Matrix3f m)
Get the inertia tensor of this Body.


getInertialTensor

public org.openmali.vecmath2.Matrix3f getInertialTensor()
Get the inertial tensor of this Body.


getGravityMode

public int getGravityMode()
Get the current mode describing how global gravity will effect this body. A value of 1 indicates gravity will effect it, a value of zero indicates it will not be effected by gravity.

Returns:
A value of 0 or 1

setGravityMode

public void setGravityMode(int mode)
Change the mode of how gravity effects this geometry. A value of 1 will tell the body to obey the world's local gravity, a value of 0 will ignore it.

Parameters:
mode - A value of 1 for global gravity, 0 for no gravity

setEnabled

public void setEnabled(boolean enabled)

isEnabled

public boolean isEnabled()

addForce

public void addForce(float x,
                     float y,
                     float z)

addForce

public final void addForce(org.openmali.vecmath2.Vector3f force)
Convienience method, just calls addForce(x,y,z)

Parameters:
force -

addForceAtPos

public void addForceAtPos(float fx,
                          float fy,
                          float fz,
                          float px,
                          float py,
                          float pz)

addForceAtRelPos

public void addForceAtRelPos(float fx,
                             float fy,
                             float fz,
                             float px,
                             float py,
                             float pz)

addRelForce

public void addRelForce(float fx,
                        float fy,
                        float fz)

addRelForceAtPos

public void addRelForceAtPos(float fx,
                             float fy,
                             float fz,
                             float px,
                             float py,
                             float pz)

addRelForceAtRelPos

public void addRelForceAtRelPos(float fx,
                                float fy,
                                float fz,
                                float px,
                                float py,
                                float pz)

addTorque

public void addTorque(float x,
                      float y,
                      float z)

getRelPointPos

public void getRelPointPos(float x,
                           float y,
                           float z,
                           float[] result)
Returns the relative body position x,y,z in world coordinates


getPointVel

public void getPointVel(float x,
                        float y,
                        float z,
                        float[] result)
Gets the velocity of a point on the body


getRelPointVel

public void getRelPointVel(float x,
                           float y,
                           float z,
                           float[] result)
Gets the relative velocity of a point on the body


addTorque

public final void addTorque(org.openmali.vecmath2.Vector3f torque)
Convenience method, just calls addTorque(x,y,z)

Parameters:
torque -

addRelTorque

public void addRelTorque(float x,
                         float y,
                         float z)

addRelTorque

public final void addRelTorque(org.openmali.vecmath2.Vector3f torque)
Convenience method, just calls addRelTorque(x,y,z)

Parameters:
torque -

getNumOfJoints

public int getNumOfJoints()
Return number of joints attached to this body.

Returns:
the number of joints

getJoints

public List<org.odejava.ode.SWIGTYPE_p_dJointID> getJoints()
Return a list of joints attached to this body, or null if none. A new list is created each time this method is called.

Returns:
A new list of the current joints

getJoints

public 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. This method will first clear the given list, even if there are no joints current. If the passed list is null, a new list instance will be created.

Parameters:
result - A list to put the joints into
Returns:
A list of the current joints or null if no joints

getId

public org.odejava.ode.SWIGTYPE_p_dBodyID getId()
Returns:
Returns the bodyId.

setId

public void setId(org.odejava.ode.SWIGTYPE_p_dBodyID bodyId)
Parameters:
bodyId - The bodyId to set.

getName

public String getName()
Fet the currently associated name string. If none is set, return null.

Specified by:
getName in interface Placeable
Returns:
The current name string or null.

setName

public void setName(String n)
Set a new name string to associate with this body.

Parameters:
n - The new name string to set.

delete

protected void delete()
Deletes the body. This is performed automatically by World.deletebody and should not be called directly.

See Also:
World.deleteBody(Body)
ODE Calls:
dBodyDestroy - destroys the body

deleteFromWorld

public void deleteFromWorld()
Removes this Body from its World and deletes it.


getContainingWorld

public World getContainingWorld()
Returns the world that contains this Body.

Returns:
the world that contains this Body.

setForce

public final void setForce(org.openmali.vecmath2.Vector3f force)
Set the force to a new value, using a vector.

Parameters:
force - A vector holding the force

setForce

public void setForce(float x,
                     float y,
                     float z)
Set the force to a new value, using individual values.

Parameters:
x - The x component of the the force
y - The y component of the the force
z - The z component of the the force

getForce

public org.openmali.vecmath2.Vector3f getForce()
Get the force of the body. A new Vector3f instance will be created for each request. This is identical to calling getForce(null).

Returns:
A new vector object containing the velocity values

getForce

public 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. If the user-provided data structure is null, then a new instance is created and returned, otherwise the user provided structure is used as the return value.

Parameters:
result - An object to place the values into or null
Returns:
Either the result parameter or a new object

getForce

public void getForce(float[] result)
Get the force of the body and place it in the user-provided array.

Parameters:
result - An object to place the values into

setAngularVel

public final void setAngularVel(org.openmali.vecmath2.Vector3f angularVel)
Set the angular velocity to a new value, using a vector.

Parameters:
angularVel - A vector holding the angular velocity

setAngularVel

public void setAngularVel(float x,
                          float y,
                          float z)
Set the angular velocity to a new value, using individual values.

Parameters:
x - The x component of the the angular velocity
y - The y component of the the angular velocity
z - The z component of the the angular velocity

getAngularVel

public org.openmali.vecmath2.Vector3f getAngularVel()
Get the angular velocity of the body. A new Vector3f instance will be created for each request. This is identical to calling getAngularVel(null).

Returns:
A new vector object containing the velocity values

getAngularVel

public 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. If the user-provided data structure is null, then a new instance is created and returned, otherwise the user provided structure is used as the return value.

Parameters:
result - An object to place the values into or null
Returns:
Either the result parameter or a new object

getAngularVel

public void getAngularVel(float[] result)
Get the angular velocity of the body and place it in the user-provided array.

Parameters:
result - An object to place the values into

setLinearVel

public final void setLinearVel(org.openmali.vecmath2.Vector3f linearVel)
Set the linear velocity to a new value, using a vector.

Parameters:
linearVel - A vector holding the linear velocity

setLinearVel

public void setLinearVel(float x,
                         float y,
                         float z)
Set the linear velocity to a new value, using individual values.

Parameters:
x - The x component of the the linear velocity
y - The y component of the the linear velocity
z - The z component of the the linear velocity

getLinearVel

public org.openmali.vecmath2.Vector3f getLinearVel()
Get the linear velocity of the body. A new Vector3f instance will be created for each request. This is identical to calling getLinearVel(null).

Returns:
A new vector object containing the velocity values

getLinearVel

public 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. If the user-provided data structure is null, then a new instance is created and returned, otherwise the user provided structure is used as the return value.

Parameters:
result - An object to place the values into or null
Returns:
Either the result parameter or a new object

getLinearVel

public void getLinearVel(float[] result)
Get the linear velocity of the body and place it in the user-provided array.

Parameters:
result - An object to place the values into

setTorque

public final void setTorque(org.openmali.vecmath2.Vector3f torque)
Set the torque to a new value, using a vector.

Parameters:
torque - A vector holding the torque

setTorque

public void setTorque(float x,
                      float y,
                      float z)
Set the torque to a new value, using individual values.

Parameters:
x - The x component of the the torque
y - The y component of the the torque
z - The z component of the the torque

getTorque

public org.openmali.vecmath2.Vector3f getTorque()
Get the torque of the body. A new Vector3f instance will be created for each request. This is identical to calling getTorque(null).

Returns:
A new vector object containing the velocity values

getTorque

public 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. If the user-provided data structure is null, then a new instance is created and returned, otherwise the user provided structure is used as the return value.

Parameters:
result - An object to place the values into or null
Returns:
Either the result parameter or a new object

getTorque

public void getTorque(float[] result)
Get the torque of the body and place it in the user-provided array.

Parameters:
result - An object to place the values into

setFiniteRotationAxis

public final void setFiniteRotationAxis(org.openmali.vecmath2.Vector3f finiteRotationAxis)
Set the finiteRotationAxis to a new value, using a vector.

Parameters:
finiteRotationAxis - A vector holding the finiteRotationAxis

setFiniteRotationAxis

public void setFiniteRotationAxis(float x,
                                  float y,
                                  float z)
Set the finiteRotationAxis to a new value, using individual values.

Parameters:
x - The x component of the the rotation axis
y - The y component of the the rotation axis
z - The z component of the the rotation axis

getFiniteRotationAxis

public org.openmali.vecmath2.Vector3f getFiniteRotationAxis()
Get the finiteRotationAxis of the body. A new Vector3f instance will be created for each request. This is identical to calling getFiniteRotationAxis(null).

Returns:
A new vector object containing the velocity values

getFiniteRotationAxis

public 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. If the user-provided data structure is null, then a new instance is created and returned, otherwise the user provided structure is used as the return value.

Parameters:
result - An object to place the values into or null
Returns:
Either the result parameter or a new object

getFiniteRotationAxis

public void getFiniteRotationAxis(float[] result)
Get the finiteRotationAxis of the body and place it in the user-provided array.

Parameters:
result - An object to place the values into

setFiniteRotationMode

public void setFiniteRotationMode(int mode)

getFiniteRotationMode

public int getFiniteRotationMode()

getBodyId

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.

Returns:
The SWIG representation of this Body identifier

setMassParameters

public 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. (cx,cy,cz) is the center of gravity position in the body frame. The Ixx values are the elements of the inertia matrix:

[ I11 I12 I13 ]
[ I12 I22 I23 ]
[ I13 I23 I33 ]

Parameters:
themass -
cgx -
cgy -
cgz -
I11 -
I22 -
I33 -
I12 -
I13 -
I23 -

fixed

public boolean fixed()
Description copied from interface: Placeable
Returns true if this Placeable is dynamic and false if it is static. Dynamic Placeable's have changing transform's whereas static ones are fixed.

Specified by:
fixed in interface Placeable
Returns:
rue if this Placeable is dynamic and false if it is static

getUserData

public Object getUserData()
Returns:
Returns the userData.

setUserData

public void setUserData(Object userData)
Parameters:
userData - The userData to set.

setAutoDisable

public void setAutoDisable(boolean state)
Control whether the world should allow auto-disable of this body. A value of true will enable the auto disable ability. Whether this body is disabled or not depends on the settings of the individual thresholds (which can be set by other methods).

Parameters:
state - True to enable auto disabling, false to disable

isAutoDisabling

public boolean isAutoDisabling()
Check to see the current state of the auto disable functionality.

Returns:
true if the auto-disable mode is on, false otherwise

setLinearVelocityDisableThreshold

public void setLinearVelocityDisableThreshold(float vel)
Set the threshold for the linear velocity that will cause a body to be disabled. Once the velocity falls below this value, the body will be subject to being disabled. The threshold is only used if the auto disable capability is enabled.

Parameters:
vel - The speed below which the body is disabled

getLinearVelocityDisableThreshold

public float getLinearVelocityDisableThreshold()
Get the threshold for linear velocity at which a body will be automatically disabled.

Returns:
The current threshold value

setAngularVelocityDisableThreshold

public void setAngularVelocityDisableThreshold(float vel)
Set the threshold for the angular velocity that will cause a body to be disabled. Once the velocity falls below this value, the body will be subject to being disabled. The threshold is only used if the auto disable capability is enabled.

Parameters:
vel - The speed below which the body is disabled

getAngularVelocityDisableThreshold

public float getAngularVelocityDisableThreshold()
Get the threshold for angular velocity at which a body will be automatically disabled.

Returns:
The current threshold value

setStepDisableThreshold

public void setStepDisableThreshold(int steps)
Set the number of evaluation steps before an umoving body is disabled. If the body has not moved in this number of steps, it is automatically disabled. This setting is only used if the auto disable capabilities is enabled. If the number of steps is negative or zero, bodies cannot be disabled using this way.

Parameters:
steps - The number of evaluation steps to use or negative to disable

getStepDisableThreshold

public int getStepDisableThreshold()
Get the threshold for the number of steps at which a body will be automatically disabled.

Returns:
The current threshold value

setTimeDisableThreshold

public void setTimeDisableThreshold(float time)
Set the total amount of evaluation time an umoving body is disabled. If the body has not moved in this time, it is automatically disabled. This setting is only used if the auto disable capabilities is enabled. If the time is negative or zero, bodies cannot be disabled using this way.

Parameters:
time - The amount of time in seconds or negative to disable

getTimeDisableThreshold

public float getTimeDisableThreshold()
Get the threshold for the evaluation time at which a body will be automatically disabled.

Returns:
The current threshold value

setQuatWXYZ

public void setQuatWXYZ(float w,
                        float x,
                        float y,
                        float z)

getQuatWXYZ

public void getQuatWXYZ(float[] result)
Get the rotation of the body expressed as a quaternion and place it in the user-provided array.

Parameters:
result - An object to place the values into, order: w,x,y,z