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


Field Summary
protected  RotationalLimitMotor[] angularLimits
           
protected  javax.vecmath.Vector3f anchorPos
           
protected  javax.vecmath.Vector3f[] calculatedAxis
           
protected  javax.vecmath.Vector3f calculatedAxisAngleDiff
           
protected  Transform calculatedTransformA
           
protected  Transform calculatedTransformB
           
protected  Transform frameInA
           
protected  Transform frameInB
           
protected  JacobianEntry[] jacAng
           
protected  JacobianEntry[] jacLinear
           
protected  TranslationalLimitMotor linearLimits
           
protected  float timeStep
           
protected  boolean useLinearReferenceFrameA
           
 
Fields inherited from class com.bulletphysics.dynamics.constraintsolver.TypedConstraint
appliedImpulse, rbA, rbB
 
Constructor Summary
Generic6DofConstraint()
           
Generic6DofConstraint(RigidBody rbA, RigidBody rbB, Transform frameInA, Transform frameInB, boolean useLinearReferenceFrameA)
           
 
Method Summary
protected  void buildAngularJacobian(int jacAngular_index, javax.vecmath.Vector3f jointAxisW)
           
 void buildJacobian()
           
protected  void buildLinearJacobian(int jacLinear_index, javax.vecmath.Vector3f normalWorld, javax.vecmath.Vector3f pivotAInW, javax.vecmath.Vector3f pivotBInW)
           
 void calcAnchorPos()
           
protected  void calculateAngleInfo()
          Calcs the euler angles between the two bodies.
 void calculateTransforms()
          Calcs global transform of the offsets.
 float getAngle(int axis_index)
          Get the relative Euler angle.
 javax.vecmath.Vector3f getAxis(int axis_index, javax.vecmath.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(javax.vecmath.Vector3f angularLower)
           
 void setAngularUpperLimit(javax.vecmath.Vector3f angularUpper)
           
 void setLimit(int axis, float lo, float hi)
          first 3 are linear, next 3 are angular
 void setLinearLowerLimit(javax.vecmath.Vector3f linearLower)
           
 void setLinearUpperLimit(javax.vecmath.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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

frameInA

protected final Transform frameInA

frameInB

protected final Transform frameInB

jacLinear

protected final JacobianEntry[] jacLinear

jacAng

protected final JacobianEntry[] jacAng

linearLimits

protected final TranslationalLimitMotor linearLimits

angularLimits

protected final RotationalLimitMotor[] angularLimits

timeStep

protected float timeStep

calculatedTransformA

protected final Transform calculatedTransformA

calculatedTransformB

protected final Transform calculatedTransformB

calculatedAxisAngleDiff

protected final javax.vecmath.Vector3f calculatedAxisAngleDiff

calculatedAxis

protected final javax.vecmath.Vector3f[] calculatedAxis

anchorPos

protected final javax.vecmath.Vector3f anchorPos

useLinearReferenceFrameA

protected boolean useLinearReferenceFrameA
Constructor Detail

Generic6DofConstraint

public Generic6DofConstraint()

Generic6DofConstraint

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

calculateAngleInfo

protected void calculateAngleInfo()
Calcs the euler angles between the two bodies.


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


buildLinearJacobian

protected void buildLinearJacobian(int jacLinear_index,
                                   javax.vecmath.Vector3f normalWorld,
                                   javax.vecmath.Vector3f pivotAInW,
                                   javax.vecmath.Vector3f pivotBInW)

buildAngularJacobian

protected void buildAngularJacobian(int jacAngular_index,
                                    javax.vecmath.Vector3f jointAxisW)

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 javax.vecmath.Vector3f getAxis(int axis_index,
                                      javax.vecmath.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(javax.vecmath.Vector3f linearLower)

setLinearUpperLimit

public void setLinearUpperLimit(javax.vecmath.Vector3f linearUpper)

setAngularLowerLimit

public void setAngularLowerLimit(javax.vecmath.Vector3f angularLower)

setAngularUpperLimit

public void setAngularUpperLimit(javax.vecmath.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()