com.bulletphysics.dynamics.constraintsolver
Class Generic6DofConstraint

java.lang.Object
  extended by com.bulletphysics.dynamics.constraintsolver.TypedConstraint
      extended by com.bulletphysics.dynamics.constraintsolver.Generic6DofConstraint

public class Generic6DofConstraint
extends TypedConstraint

Generic6DofConstraint between two rigidbodies each with a pivot point that descibes the axis location in local space.

Generic6DofConstraint can leave any of the 6 degree of freedom "free" or "locked". Currently this limit supports rotational motors.


Constructor Summary
Generic6DofConstraint()
           
Generic6DofConstraint(RigidBody rbA, RigidBody rbB, Transform frameInA, Transform frameInB, boolean useLinearReferenceFrameA)
           
 
Method Summary
 void buildJacobian()
           
 void calcAnchorPos()
           
 void calculateTransforms()
          Calcs global transform of the offsets.
 float getAngle(int axis_index)
          Get the relative Euler angle.
 Vector3f getAxis(int axis_index, Vector3f out)
          Get the rotation axis in global coordinates.
 Transform getCalculatedTransformA(Transform out)
          Gets the global transform of the offset for body A.
 Transform getCalculatedTransformB(Transform out)
          Gets the global transform of the offset for body B.
 Transform getFrameOffsetA(Transform out)
           
 Transform getFrameOffsetB(Transform out)
           
 RotationalLimitMotor getRotationalLimitMotor(int index)
          Retrieves the angular limit informacion.
 TranslationalLimitMotor getTranslationalLimitMotor()
          Retrieves the limit informacion.
 boolean isLimited(int limitIndex)
          Test limit.
 void setAngularLowerLimit(Vector3f angularLower)
           
 void setAngularUpperLimit(Vector3f angularUpper)
           
 void setLimit(int axis, float lo, float hi)
          first 3 are linear, next 3 are angular
 void setLinearLowerLimit(Vector3f linearLower)
           
 void setLinearUpperLimit(Vector3f linearUpper)
           
 void solveConstraint(float timeStep)
           
 boolean testAngularLimitMotor(int axis_index)
          Test angular limit.
 void updateRHS(float timeStep)
           
 
Methods inherited from class com.bulletphysics.dynamics.constraintsolver.TypedConstraint
getAppliedImpulse, getConstraintType, getRigidBodyA, getRigidBodyB, getUid, getUserConstraintId, getUserConstraintType, setUserConstraintId, setUserConstraintType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Generic6DofConstraint

public Generic6DofConstraint()

Generic6DofConstraint

public Generic6DofConstraint(RigidBody rbA,
                             RigidBody rbB,
                             Transform frameInA,
                             Transform frameInB,
                             boolean useLinearReferenceFrameA)
Method Detail

calculateTransforms

public void calculateTransforms()
Calcs global transform of the offsets.

Calcs the global transform for the joint offset for body A an B, and also calcs the agle differences between the bodies. See also: Generic6DofConstraint.getCalculatedTransformA, Generic6DofConstraint.getCalculatedTransformB, Generic6DofConstraint.calculateAngleInfo


testAngularLimitMotor

public boolean testAngularLimitMotor(int axis_index)
Test angular limit.

Calculates angular correction and returns true if limit needs to be corrected. Generic6DofConstraint.buildJacobian must be called previously.


buildJacobian

public void buildJacobian()
Specified by:
buildJacobian in class TypedConstraint

solveConstraint

public void solveConstraint(float timeStep)
Specified by:
solveConstraint in class TypedConstraint

updateRHS

public void updateRHS(float timeStep)

getAxis

public Vector3f getAxis(int axis_index,
                        Vector3f out)
Get the rotation axis in global coordinates. Generic6DofConstraint.buildJacobian must be called previously.


getAngle

public float getAngle(int axis_index)
Get the relative Euler angle. Generic6DofConstraint.buildJacobian must be called previously.


getCalculatedTransformA

public Transform getCalculatedTransformA(Transform out)
Gets the global transform of the offset for body A.

See also: Generic6DofConstraint.getFrameOffsetA, Generic6DofConstraint.getFrameOffsetB, Generic6DofConstraint.calculateAngleInfo.


getCalculatedTransformB

public Transform getCalculatedTransformB(Transform out)
Gets the global transform of the offset for body B.

See also: Generic6DofConstraint.getFrameOffsetA, Generic6DofConstraint.getFrameOffsetB, Generic6DofConstraint.calculateAngleInfo.


getFrameOffsetA

public Transform getFrameOffsetA(Transform out)

getFrameOffsetB

public Transform getFrameOffsetB(Transform out)

setLinearLowerLimit

public void setLinearLowerLimit(Vector3f linearLower)

setLinearUpperLimit

public void setLinearUpperLimit(Vector3f linearUpper)

setAngularLowerLimit

public void setAngularLowerLimit(Vector3f angularLower)

setAngularUpperLimit

public void setAngularUpperLimit(Vector3f angularUpper)

getRotationalLimitMotor

public RotationalLimitMotor getRotationalLimitMotor(int index)
Retrieves the angular limit informacion.


getTranslationalLimitMotor

public TranslationalLimitMotor getTranslationalLimitMotor()
Retrieves the limit informacion.


setLimit

public void setLimit(int axis,
                     float lo,
                     float hi)
first 3 are linear, next 3 are angular


isLimited

public boolean isLimited(int limitIndex)
Test limit.

- free means upper < lower,
- locked means upper == lower
- limited means upper > lower
- limitIndex: first 3 are linear, next 3 are angular


calcAnchorPos

public void calcAnchorPos()