org.ode4j.ode
Interface DBody


public interface DBody

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 dynamical property (except insofar as it influences the various mass properties). It is only collision detection that cares about the detailed shape of the body.

    From odecpp.h.


    Nested Class Summary
    static interface DBody.BodyMoveCallBack
              Whenever a body has its position or rotation changed during the timestep, the callback will be called (with body as the argument).
     
    Method Summary
     void addForce(double fx, double fy, double fz)
              Add force at centre of mass of body in absolute coordinates.
     void addForce(DVector3C f)
              Add force at centre of mass of body in absolute coordinates.
     void addForceAtPos(double fx, double fy, double fz, double px, double py, double pz)
              Add force at specified point in body in global coordinates.
     void addForceAtPos(DVector3C f, DVector3C p)
              Add force at specified point in body in global coordinates.
     void addForceAtRelPos(double fx, double fy, double fz, double px, double py, double pz)
              Add force at specified point in body in local coordinates.
     void addForceAtRelPos(DVector3C f, DVector3C p)
              Add force at specified point in body in local coordinates.
     void addRelForce(double fx, double fy, double fz)
              Add force at centre of mass of body in coordinates relative to body.
     void addRelForce(DVector3C f)
              Add force at centre of mass of body in coordinates relative to body.
     void addRelForceAtPos(double fx, double fy, double fz, double px, double py, double pz)
              Add force at specified point in body in global coordinates.
     void addRelForceAtPos(DVector3C f, DVector3C p)
              Add force at specified point in body in global coordinates.
     void addRelForceAtRelPos(double fx, double fy, double fz, double px, double py, double pz)
              Add force at specified point in body in local coordinates.
     void addRelForceAtRelPos(DVector3C f, DVector3C p)
              Add force at specified point in body in local coordinates.
     void addRelTorque(double fx, double fy, double fz)
              Add torque at centre of mass of body in coordinates relative to body.
     void addRelTorque(DVector3C t)
              Add torque at centre of mass of body in coordinates relative to body.
     void addTorque(double fx, double fy, double fz)
              Add torque at centre of mass of body in absolute coordinates.
     void addTorque(DVector3C t)
              Add torque at centre of mass of body in absolute coordinates.
     void destroy()
              Destroy a body.
     void DESTRUCTOR()
               
     void disable()
              Manually disable a body.
     void enable()
              Manually enable a body.
     double getAngularDamping()
              Get the body's angular damping scale.
     double getAngularDampingThreshold()
              Get the body's angular damping threshold.
     DVector3C getAngularVel()
              Get the angular velocity of a body.
     double getAutoDisableAngularThreshold()
              Get auto disable angular average threshold.
     int getAutoDisableAverageSamplesCount()
              Get auto disable average size (samples count).
     boolean getAutoDisableFlag()
              Get auto disable flag.
     double getAutoDisableLinearThreshold()
              Get auto disable linear average threshold.
     int getAutoDisableSteps()
              Get auto steps a body must be thought of as idle to disable
     double getAutoDisableTime()
              Get auto disable time.
     java.lang.Object getData()
              Get the body's user-data pointer.
     void getFiniteRotationAxis(DVector3 result)
              Get the finite rotation axis.
     boolean getFiniteRotationMode()
              Get the way a body's orientation is updated each timestep.
     DGeom getFirstGeom()
              Deprecated. May be replaced by a more Java-like API.
     DVector3C getForce()
              Return the current accumulated force vector.
     boolean getGravityMode()
              Get whether the body is influenced by the world's gravity or not.
     boolean getGyroscopicMode()
              Get the body's gyroscopic state.
     DJoint getJoint(int index)
              Return a joint attached to this body, given by index.
     double getLinearDamping()
              Get the body's linear damping scale.
     double getLinearDampingThreshold()
              Get the body's linear damping threshold.
     DVector3C getLinearVel()
              Get the linear velocity of a body.
     DMassC getMass()
              Get the mass of a body.
     double getMaxAngularSpeed()
              Get the body's maximum angular speed.
     DGeom getNextGeom(DGeom geom)
              Deprecated. May be replaced by a more Java-like API.
     int getNumJoints()
              Get the number of joints that are attached to this body.
     void getPointVel(double px, double py, double pz, DVector3 result)
              Get velocity vector in global coords of a globally specified point on a body.
     void getPointVel(DVector3C p, DVector3 result)
              Get velocity vector in global coords of a globally specified point on a body.
     DVector3C getPosition()
              Get the position of a body.
     void getPosRelPoint(double px, double py, double pz, DVector3 result)
              Takes a point in global coordinates and returns the point's position in body-relative coordinates.
     void getPosRelPoint(DVector3C p, DVector3 result)
              Takes a point in global coordinates and returns the point's position in body-relative coordinates.
     DQuaternionC getQuaternion()
              Get the rotation of a body.
     void getRelPointPos(double px, double py, double pz, DVector3 result)
              Get world position of a relative point on body.
     void getRelPointPos(DVector3C p, DVector3 result)
              Get world position of a relative point on body.
     void getRelPointVel(double px, double py, double pz, DVector3 result)
              Get velocity vector in global coords of a relative point on body.
     void getRelPointVel(DVector3C p, DVector3 result)
              Get velocity vector in global coords of a relative point on body.
     DMatrix3C getRotation()
              Get the rotation of a body.
     DVector3C getTorque()
              Return the current accumulated torque vector.
     DWorld getWorld()
              Retrieves the world attached to the given body.
     boolean isConnectedTo(DBody body)
               
     boolean isEnabled()
              Check wether a body is enabled.
     boolean isKinematic()
              Check wether a body is in kinematic state.
     void setAngularDamping(double scale)
              Set the body's angular damping scale.
     void setAngularDampingThreshold(double threshold)
              Set the body's angular damping threshold.
     void setAngularVel(double x, double y, double z)
              Set the angular velocity of a body.
     void setAngularVel(DVector3C v)
              Set the angular velocity of a body.
     void setAutoDisableAngularThreshold(double threshold)
              Set auto disable angular average threshold.
     void setAutoDisableAverageSamplesCount(int average_samples_count)
              Set auto disable average buffer size (average steps).
     void setAutoDisableDefaults()
              Set auto disable defaults.
     void setAutoDisableFlag(boolean do_auto_disable)
              Set auto disable flag.
     void setAutoDisableLinearThreshold(double threshold)
              Set auto disable linear average threshold.
     void setAutoDisableSteps(int steps)
              Set auto disable steps.
     void setAutoDisableTime(double time)
              Set auto disable time.
     void setDamping(double linear_scale, double angular_scale)
              Convenience function to set linear and angular scales at once.
     void setDampingDefaults()
              Resets the damping settings to the current world's settings.
     void setData(java.lang.Object data)
              Set the body's user-data pointer.
     void setDynamic()
              Set rigid body to dynamic state (default).
     void setFiniteRotationAxis(double x, double y, double z)
              Sets the finite rotation axis for a body.
     void setFiniteRotationAxis(DVector3C a)
              Sets the finite rotation axis for a body.
     void setFiniteRotationMode(boolean mode)
              Controls the way a body's orientation is updated at each timestep.
     void setForce(double x, double y, double z)
              Set the body force accumulation vector.
     void setForce(DVector3C f)
              Set the body force accumulation vector.
     void setGravityMode(boolean mode)
              Set whether the body is influenced by the world's gravity or not.
     void setGyroscopicMode(boolean enabled)
              Enable/disable the body's gyroscopic term.
     void setKinematic()
              Set rigid body to kinematic state.
     void setLinearDamping(double scale)
              Set the body's linear damping scale.
     void setLinearDampingThreshold(double threshold)
              Set the body's linear damping threshold.
     void setLinearVel(double x, double y, double z)
              Set the linear velocity of a body.
     void setLinearVel(DVector3C v)
              Set the linear velocity of a body.
     void setMass(DMassC mass)
              Set the mass of a body.
     void setMaxAngularSpeed(double max_speed)
              Set the body's maximum angular speed.
     void setMovedCallback(DBody.BodyMoveCallBack callback)
              Set the 'moved' callback of a body.
     void setPosition(double x, double y, double z)
              Set position of a body.
     void setPosition(DVector3C p)
              Set position of a body.
     void setQuaternion(DQuaternionC q)
              Set the orientation of a body.
     void setRotation(DMatrix3C R)
              Set the orientation of a body.
     void setTorque(double x, double y, double z)
              Set the body torque accumulation vector.
     void setTorque(DVector3C t)
              Set the body torque accumulation vector.
     void vectorFromWorld(double px, double py, double pz, DVector3 result)
              Convert from world to local coordinates.
     void vectorFromWorld(DVector3C p, DVector3 result)
              Convert from world to local coordinates.
     void vectorToWorld(double px, double py, double pz, DVector3 result)
              Convert from local to world coordinates.
     void vectorToWorld(DVector3C p, DVector3 result)
              Convert from local to world coordinates.
     

    Method Detail

    DESTRUCTOR

    void DESTRUCTOR()

    destroy

    void destroy()
    Destroy a body.

    Remark:
    All joints that are attached to this body will be put into limbo: i.e. unattached and not affecting the simulation, but they will NOT be deleted.

    setData

    void setData(java.lang.Object data)
    Set the body's user-data pointer.

    Parameters:
    data - arbitraty pointer

    getData

    java.lang.Object getData()
    Get the body's user-data pointer.

    Returns:
    a pointer to the user's data.

    setPosition

    void setPosition(double x,
                     double y,
                     double z)
    Set position of a body.

    Remark:
    After setting, the outcome of the simulation is undefined if the new configuration is inconsistent with the joints/constraints that are present.

    setPosition

    void setPosition(DVector3C p)
    Set position of a body.

    Remark:
    After setting, the outcome of the simulation is undefined if the new configuration is inconsistent with the joints/constraints that are present.

    setRotation

    void setRotation(DMatrix3C R)
    Set the orientation of a body.

    Remark:
    After setting, the outcome of the simulation is undefined if the new configuration is inconsistent with the joints/constraints that are present.

    setQuaternion

    void setQuaternion(DQuaternionC q)
    Set the orientation of a body.

    Remark:
    After setting, the outcome of the simulation is undefined if the new configuration is inconsistent with the joints/constraints that are present.

    setLinearVel

    void setLinearVel(double x,
                      double y,
                      double z)
    Set the linear velocity of a body.


    setLinearVel

    void setLinearVel(DVector3C v)
    Set the linear velocity of a body.


    setAngularVel

    void setAngularVel(double x,
                       double y,
                       double z)
    Set the angular velocity of a body.


    setAngularVel

    void setAngularVel(DVector3C v)
    Set the angular velocity of a body.


    getPosition

    DVector3C getPosition()
    Get the position of a body.

    Remark:
    When getting, the returned values are pointers to internal data structures, so the vectors are valid until any changes are made to the rigid body system structure.

    getRotation

    DMatrix3C getRotation()
    Get the rotation of a body.

    Returns:
    pointer to a 4x3 rotation matrix.

    getQuaternion

    DQuaternionC getQuaternion()
    Get the rotation of a body.

    Returns:
    pointer to 4 scalars that represent the quaternion.

    getLinearVel

    DVector3C getLinearVel()
    Get the linear velocity of a body.


    getAngularVel

    DVector3C getAngularVel()
    Get the angular velocity of a body.


    setMass

    void setMass(DMassC mass)
    Set the mass of a body.


    getMass

    DMassC getMass()
    Get the mass of a body.


    getWorld

    DWorld getWorld()
    Retrieves the world attached to the given body.

    Remark:

    setAutoDisableLinearThreshold

    void setAutoDisableLinearThreshold(double threshold)
    Set auto disable linear average threshold.


    getAutoDisableLinearThreshold

    double getAutoDisableLinearThreshold()
    Get auto disable linear average threshold.

    Returns:
    the threshold

    setAutoDisableAngularThreshold

    void setAutoDisableAngularThreshold(double threshold)
    Set auto disable angular average threshold.


    getAutoDisableAngularThreshold

    double getAutoDisableAngularThreshold()
    Get auto disable angular average threshold.

    Returns:
    the threshold

    setAutoDisableSteps

    void setAutoDisableSteps(int steps)
    Set auto disable steps.

    Parameters:
    steps - the nr of steps.

    getAutoDisableSteps

    int getAutoDisableSteps()
    Get auto steps a body must be thought of as idle to disable

    Returns:
    the nr of steps

    setAutoDisableTime

    void setAutoDisableTime(double time)
    Set auto disable time.

    Parameters:
    time - nr of seconds.

    getAutoDisableTime

    double getAutoDisableTime()
    Get auto disable time.

    Returns:
    nr of seconds

    setAutoDisableFlag

    void setAutoDisableFlag(boolean do_auto_disable)
    Set auto disable flag.

    Parameters:
    do_auto_disable - 0 or 1

    getAutoDisableFlag

    boolean getAutoDisableFlag()
    Get auto disable flag.

    Returns:
    0 or 1

    getAutoDisableAverageSamplesCount

    int getAutoDisableAverageSamplesCount()
    Get auto disable average size (samples count).

    Returns:
    the nr of steps/size.

    setAutoDisableAverageSamplesCount

    void setAutoDisableAverageSamplesCount(int average_samples_count)
    Set auto disable average buffer size (average steps).

    Parameters:
    average_samples_count - the nr of samples to review.

    setAutoDisableDefaults

    void setAutoDisableDefaults()
    Set auto disable defaults.

    Remark:
    Set the values for the body to those set as default for the world.

    addForce

    void addForce(double fx,
                  double fy,
                  double fz)
    Add force at centre of mass of body in absolute coordinates.


    addForce

    void addForce(DVector3C f)
    Add force at centre of mass of body in absolute coordinates.


    addTorque

    void addTorque(double fx,
                   double fy,
                   double fz)
    Add torque at centre of mass of body in absolute coordinates.


    addTorque

    void addTorque(DVector3C t)
    Add torque at centre of mass of body in absolute coordinates.


    addRelForce

    void addRelForce(double fx,
                     double fy,
                     double fz)
    Add force at centre of mass of body in coordinates relative to body.


    addRelForce

    void addRelForce(DVector3C f)
    Add force at centre of mass of body in coordinates relative to body.


    addRelTorque

    void addRelTorque(double fx,
                      double fy,
                      double fz)
    Add torque at centre of mass of body in coordinates relative to body.


    addRelTorque

    void addRelTorque(DVector3C t)
    Add torque at centre of mass of body in coordinates relative to body.


    addForceAtPos

    void addForceAtPos(double fx,
                       double fy,
                       double fz,
                       double px,
                       double py,
                       double pz)
    Add force at specified point in body in global coordinates.


    addForceAtPos

    void addForceAtPos(DVector3C f,
                       DVector3C p)
    Add force at specified point in body in global coordinates.


    addForceAtRelPos

    void addForceAtRelPos(double fx,
                          double fy,
                          double fz,
                          double px,
                          double py,
                          double pz)
    Add force at specified point in body in local coordinates.


    addForceAtRelPos

    void addForceAtRelPos(DVector3C f,
                          DVector3C p)
    Add force at specified point in body in local coordinates.


    addRelForceAtPos

    void addRelForceAtPos(double fx,
                          double fy,
                          double fz,
                          double px,
                          double py,
                          double pz)
    Add force at specified point in body in global coordinates.


    addRelForceAtPos

    void addRelForceAtPos(DVector3C f,
                          DVector3C p)
    Add force at specified point in body in global coordinates.


    addRelForceAtRelPos

    void addRelForceAtRelPos(double fx,
                             double fy,
                             double fz,
                             double px,
                             double py,
                             double pz)
    Add force at specified point in body in local coordinates.


    addRelForceAtRelPos

    void addRelForceAtRelPos(DVector3C f,
                             DVector3C p)
    Add force at specified point in body in local coordinates.


    getForce

    DVector3C getForce()
    Return the current accumulated force vector.

    Returns:
    points to an array of 3 reals.
    Remark:
    The returned values are pointers to internal data structures, so the vectors are only valid until any changes are made to the rigid body system.

    getTorque

    DVector3C getTorque()
    Return the current accumulated torque vector.

    Returns:
    points to an array of 3 reals.
    Remark:
    The returned values are pointers to internal data structures, so the vectors are only valid until any changes are made to the rigid body system.

    setForce

    void setForce(double x,
                  double y,
                  double z)
    Set the body force accumulation vector.

    Remark:
    This is mostly useful to zero the force and torque for deactivated bodies before they are reactivated, in the case where the force-adding functions were called on them while they were deactivated.

    setForce

    void setForce(DVector3C f)
    Set the body force accumulation vector.

    Remark:
    This is mostly useful to zero the force and torque for deactivated bodies before they are reactivated, in the case where the force-adding functions were called on them while they were deactivated.

    setTorque

    void setTorque(double x,
                   double y,
                   double z)
    Set the body torque accumulation vector.

    Remark:
    This is mostly useful to zero the force and torque for deactivated bodies before they are reactivated, in the case where the force-adding functions were called on them while they were deactivated.

    setTorque

    void setTorque(DVector3C t)
    Set the body torque accumulation vector.

    Remark:
    This is mostly useful to zero the force and torque for deactivated bodies before they are reactivated, in the case where the force-adding functions were called on them while they were deactivated.

    getRelPointPos

    void getRelPointPos(double px,
                        double py,
                        double pz,
                        DVector3 result)
    Get world position of a relative point on body.

    Parameters:
    result - will contain the result.

    getRelPointPos

    void getRelPointPos(DVector3C p,
                        DVector3 result)
    Get world position of a relative point on body.

    Parameters:
    result - will contain the result.

    getRelPointVel

    void getRelPointVel(double px,
                        double py,
                        double pz,
                        DVector3 result)
    Get velocity vector in global coords of a relative point on body.

    Parameters:
    result - will contain the result.

    getRelPointVel

    void getRelPointVel(DVector3C p,
                        DVector3 result)
    Get velocity vector in global coords of a relative point on body.

    Parameters:
    result - will contain the result.

    getPointVel

    void getPointVel(double px,
                     double py,
                     double pz,
                     DVector3 result)
    Get velocity vector in global coords of a globally specified point on a body.

    Parameters:
    result - will contain the result.

    getPointVel

    void getPointVel(DVector3C p,
                     DVector3 result)
    Get velocity vector in global coords of a globally specified point on a body.

    Parameters:
    result - will contain the result.

    getPosRelPoint

    void getPosRelPoint(double px,
                        double py,
                        double pz,
                        DVector3 result)
    Takes a point in global coordinates and returns the point's position in body-relative coordinates.

    Parameters:
    result - will contain the result.
    Remark:
    This is the inverse of dBodyGetRelPointPos()

    getPosRelPoint

    void getPosRelPoint(DVector3C p,
                        DVector3 result)
    Takes a point in global coordinates and returns the point's position in body-relative coordinates.

    Parameters:
    result - will contain the result.
    Remark:
    This is the inverse of dBodyGetRelPointPos()

    vectorToWorld

    void vectorToWorld(double px,
                       double py,
                       double pz,
                       DVector3 result)
    Convert from local to world coordinates.

    Parameters:
    result - will contain the result.

    vectorToWorld

    void vectorToWorld(DVector3C p,
                       DVector3 result)
    Convert from local to world coordinates.

    Parameters:
    result - will contain the result.

    vectorFromWorld

    void vectorFromWorld(double px,
                         double py,
                         double pz,
                         DVector3 result)
    Convert from world to local coordinates.

    Parameters:
    result - will contain the result.

    vectorFromWorld

    void vectorFromWorld(DVector3C p,
                         DVector3 result)
    Convert from world to local coordinates.

    Parameters:
    result - will contain the result.

    setFiniteRotationMode

    void setFiniteRotationMode(boolean mode)
    Controls the way a body's orientation is updated at each timestep.

    Parameters:
    mode - can be 0 or 1:
  • 0: An ``infinitesimal'' orientation update is used. This is fast to compute, but it can occasionally cause inaccuracies for bodies that are rotating at high speed, especially when those bodies are joined to other bodies. This is the default for every new body that is created.
  • 1: A ``finite'' orientation update is used. This is more costly to compute, but will be more accurate for high speed rotations.
  • Remark:
    Note however that high speed rotations can result in many types of error in a simulation, and the finite mode will only fix one of those sources of error.

    setFiniteRotationAxis

    void setFiniteRotationAxis(double x,
                               double y,
                               double z)
    Sets the finite rotation axis for a body.

    Remark:
    This is axis only has meaning when the finite rotation mode is set If this axis is zero (0,0,0), full finite rotations are performed on the body. If this axis is nonzero, the body is rotated by performing a partial finite rotation along the axis direction followed by an infinitesimal rotation along an orthogonal direction., This can be useful to alleviate certain sources of error caused by quickly spinning bodies. For example, if a car wheel is rotating at high speed you can call this function with the wheel's hinge axis as the argument to try and improve its behavior.

    setFiniteRotationAxis

    void setFiniteRotationAxis(DVector3C a)
    Sets the finite rotation axis for a body.

    Remark:
    This is axis only has meaning when the finite rotation mode is set If this axis is zero (0,0,0), full finite rotations are performed on the body. If this axis is nonzero, the body is rotated by performing a partial finite rotation along the axis direction followed by an infinitesimal rotation along an orthogonal direction., This can be useful to alleviate certain sources of error caused by quickly spinning bodies. For example, if a car wheel is rotating at high speed you can call this function with the wheel's hinge axis as the argument to try and improve its behavior.

    getFiniteRotationMode

    boolean getFiniteRotationMode()
    Get the way a body's orientation is updated each timestep.

    Returns:
    the mode 0 (infitesimal) or 1 (finite).

    getFiniteRotationAxis

    void getFiniteRotationAxis(DVector3 result)
    Get the finite rotation axis.

    Parameters:
    result - will contain the axis.

    getNumJoints

    int getNumJoints()
    Get the number of joints that are attached to this body.

    Returns:
    nr of joints

    getJoint

    DJoint getJoint(int index)
    Return a joint attached to this body, given by index.

    Parameters:
    index - valid range is 0 to n-1 where n is the value returned by dBodyGetNumJoints().

    setDynamic

    void setDynamic()
    Set rigid body to dynamic state (default).


    setKinematic

    void setKinematic()
    Set rigid body to kinematic state. When in kinematic state the body isn't simulated as a dynamic body (it's "unstoppable", doesn't respond to forces), but can still affect dynamic bodies (e.g. in joints). Kinematic bodies can be controlled by position and velocity.

    Note:
    A kinematic body has infinite mass. If you set its mass to something else, it loses the kinematic state and behaves as a normal dynamic body.

    isKinematic

    boolean isKinematic()
    Check wether a body is in kinematic state.

    Returns:
    1 if a body is kinematic or 0 if it is dynamic.

    enable

    void enable()
    Manually enable a body.


    disable

    void disable()
    Manually disable a body.

    Remark:
    A disabled body that is connected through a joint to an enabled body will be automatically re-enabled at the next simulation step.

    isEnabled

    boolean isEnabled()
    Check wether a body is enabled.

    Returns:
    1 if a body is currently enabled or 0 if it is disabled.

    setGravityMode

    void setGravityMode(boolean mode)
    Set whether the body is influenced by the world's gravity or not.

    Parameters:
    mode - when nonzero gravity affects this body.
    Remark:
    Newly created bodies are always influenced by the world's gravity.

    getGravityMode

    boolean getGravityMode()
    Get whether the body is influenced by the world's gravity or not.

    Returns:
    nonzero means gravity affects this body.

    isConnectedTo

    boolean isConnectedTo(DBody body)

    getLinearDamping

    double getLinearDamping()
    Get the body's linear damping scale.


    setLinearDamping

    void setLinearDamping(double scale)
    Set the body's linear damping scale.

    Parameters:
    scale - The linear damping scale. Should be in the interval [0, 1].
    See Also:
    setDampingDefaults()
    Remark:
    From now on the body will not use the world's linear damping scale until dBodySetDampingDefaults() is called.

    getAngularDamping

    double getAngularDamping()
    Get the body's angular damping scale.

    Remark:
    If the body's angular damping scale was not set, this function returns the world's angular damping scale.

    setAngularDamping

    void setAngularDamping(double scale)
    Set the body's angular damping scale.

    Parameters:
    scale - The angular damping scale. Should be in the interval [0, 1].
    Remark:
    From now on the body will not use the world's angular damping scale until dBodyResetAngularDamping() is called.

    setDamping

    void setDamping(double linear_scale,
                    double angular_scale)
    Convenience function to set linear and angular scales at once.

    Parameters:
    linear_scale - The linear damping scale. Should be in the interval [0, 1].
    angular_scale - The angular damping scale. Should be in the interval [0, 1].
    See Also:
    setLinearDamping(double), setAngularDamping(double)

    getLinearDampingThreshold

    double getLinearDampingThreshold()
    Get the body's linear damping threshold.


    setLinearDampingThreshold

    void setLinearDampingThreshold(double threshold)
    Set the body's linear damping threshold.

    Parameters:
    threshold - The linear threshold to be used. Damping is only applied if the linear speed is above this limit.

    getAngularDampingThreshold

    double getAngularDampingThreshold()
    Get the body's angular damping threshold.


    setAngularDampingThreshold

    void setAngularDampingThreshold(double threshold)
    Set the body's angular damping threshold.

    Parameters:
    threshold - The angular threshold to be used. Damping is only used if the angular speed is above this limit.

    setDampingDefaults

    void setDampingDefaults()
    Resets the damping settings to the current world's settings.


    getMaxAngularSpeed

    double getMaxAngularSpeed()
    Get the body's maximum angular speed.

    See Also:
    DWorld.getMaxAngularSpeed()

    setMaxAngularSpeed

    void setMaxAngularSpeed(double max_speed)
    Set the body's maximum angular speed.

    See Also:
    DWorld.setMaxAngularSpeed(double)

    getGyroscopicMode

    boolean getGyroscopicMode()
    Get the body's gyroscopic state.

    Returns:
    nonzero if gyroscopic term computation is enabled (default), zero otherwise.

    setGyroscopicMode

    void setGyroscopicMode(boolean enabled)
    Enable/disable the body's gyroscopic term. Disabling the gyroscopic term of a body usually improves stability. It also helps turning spining objects, like cars' wheels.

    Parameters:
    enabled - nonzero (default) to enable gyroscopic term, 0 to disable.

    setMovedCallback

    void setMovedCallback(DBody.BodyMoveCallBack callback)
    Set the 'moved' callback of a body. Whenever a body has its position or rotation changed during the timestep, the callback will be called (with body as the argument). Use it to know which body may need an update in an external structure (like a 3D engine).

    Parameters:
    callback - the callback to be invoked when the body moves. Set to zero to disable.

    getFirstGeom

    DGeom getFirstGeom()
    Deprecated. May be replaced by a more Java-like API.

    Return the first geom associated with the body. You can traverse through the geoms by repeatedly calling dBodyGetNextGeom().

    Returns:
    the first geom attached to this body, or 0.

    getNextGeom

    DGeom getNextGeom(DGeom geom)
    Deprecated. May be replaced by a more Java-like API.

    Returns the next geom associated with the same body.

    Parameters:
    geom - a geom attached to some body.
    Returns:
    the next geom attached to the same body, or 0.
    See Also:
    getFirstGeom()