Package com.jme3.bullet.joints
Class SixDofJoint
java.lang.Object
com.jme3.bullet.NativePhysicsObject
com.jme3.bullet.joints.PhysicsJoint
com.jme3.bullet.joints.Constraint
com.jme3.bullet.joints.SixDofJoint
- All Implemented Interfaces:
Comparable<NativePhysicsObject>
- Direct Known Subclasses:
SixDofSpringJoint
A 6 degree-of-freedom joint based on Bullet's btGeneric6DofConstraint. Axis
rotations are applied in XYZ order.
From the Bullet manual:
For each axis:
- Lowerlimit = Upperlimit → axis is locked
- Lowerlimit > Upperlimit → axis is free
- Lowerlimit < Upperlimit → axis is limited in that range
It is recommended to use the btGeneric6DofSpring2Constraint, it has some improvements over the original btGeneric6Dof(Spring)Constraint.
- See Also:
-
Field Summary
Fields inherited from class com.jme3.bullet.joints.Constraint
logger15, pivotA, pivotB
Fields inherited from class com.jme3.bullet.joints.PhysicsJoint
logger
Fields inherited from class com.jme3.bullet.NativePhysicsObject
loggerN
-
Constructor Summary
ConstructorDescriptionSixDofJoint
(PhysicsRigidBody rigidBodyA, PhysicsRigidBody rigidBodyB, Vector3f pivotInA, Vector3f pivotInB, boolean useLinearReferenceFrameA) Instantiate a double-ended SixDofJoint.SixDofJoint
(PhysicsRigidBody rigidBodyA, PhysicsRigidBody rigidBodyB, Vector3f pivotInA, Vector3f pivotInB, Matrix3f rotInA, Matrix3f rotInB, boolean useLinearReferenceFrameA) Instantiate a double-ended SixDofJoint.SixDofJoint
(PhysicsRigidBody rigidBodyB, Vector3f pivotInB, Vector3f pivotInWorld, Matrix3f rotInB, Matrix3f rotInWorld, JointEnd linearReferenceFrame) Instantiate a single-ended SixDofJoint. -
Method Summary
Modifier and TypeMethodDescriptionprotected long
createJoint
(long bodyIdA, long bodyIdB, Vector3f pivotInA, Matrix3f rotInA, Vector3f pivotInB, Matrix3f rotInB, boolean useLinearReferenceFrameA) Create a double-endedbtGeneric6DofConstraint
.protected long
createJoint1
(long bodyIdB, Vector3f pivotInB, Matrix3f rotInB, boolean useLinearReferenceFrameB) Create a single-endedbtGeneric6DofConstraint
.Copy the joint's rotation angles.getAngularLowerLimit
(Vector3f storeResult) Copy the joint's lower limits for rotation on all 3 axes.getAngularUpperLimit
(Vector3f storeResult) Copy the joint's upper limits for rotation on all 3 axes.getFrameTransform
(JointEnd end, Transform storeResult) Copy the joint's frame transform relative to the specified end.getLinearLowerLimit
(Vector3f storeResult) Copy the joint's lower limits for translation on all 3 axes.getLinearUpperLimit
(Vector3f storeResult) Copy the joint's upper limits for translation on all 3 axes.getPivotOffset
(Vector3f storeResult) Copy the joint's pivot offset.getRotationalLimitMotor
(int axisIndex) Access the indexed RotationalLimitMotor of this joint, the motor which influences rotation around the indexed axis.Access the TranslationalLimitMotor of this joint, the motor which influences translation on all 3 axes.void
setAngularLowerLimit
(Vector3f limits) Alter the joint's lower limits for rotation of all 3 axes.void
setAngularUpperLimit
(Vector3f limits) Alter the joint's upper limits for rotation of all 3 axes.void
setLinearLowerLimit
(Vector3f vector) Alter the joint's lower limits for translation of all 3 axes.void
setLinearUpperLimit
(Vector3f vector) Alter the joint's upper limits for translation of all 3 axes.Methods inherited from class com.jme3.bullet.joints.Constraint
getAppliedImpulse, getBodyA, getBodyB, getBreakingImpulseThreshold, getConstraintType, getOverrideIterations, getPivot, getPivotA, getPivotB, isCollisionBetweenLinkedBodies, isEnabled, isFeedback, overrideIterations, setBreakingImpulseThreshold, setCollisionBetweenLinkedBodies, setEnabled, setFeedback, setPivotInA, setPivotInB
Methods inherited from class com.jme3.bullet.joints.PhysicsJoint
countEnds, destroy, findEnd, findOtherBody, getBody, getPhysicsSpace, setBodyA, setBodyB, setNativeId, setPhysicsSpace, toString
Methods inherited from class com.jme3.bullet.NativePhysicsObject
compareTo, countTrackers, dumpTrackers, equals, freeUnusedObjects, hasAssignedNativeObject, hashCode, nativeId, reassignNativeId, setNativeIdNotTracked, unassignNativeObject
-
Field Details
-
logger2
message logger for this class
-
-
Constructor Details
-
SixDofJoint
public SixDofJoint(PhysicsRigidBody rigidBodyB, Vector3f pivotInB, Vector3f pivotInWorld, Matrix3f rotInB, Matrix3f rotInWorld, JointEnd linearReferenceFrame) Instantiate a single-ended SixDofJoint.To be effective, the joint must be added to the body's PhysicsSpace and the body must be dynamic.
- Parameters:
rigidBodyB
- the body to constrain (not null, alias created)pivotInB
- the pivot location in B's scaled local coordinates (not null, unaffected)pivotInWorld
- the pivot location in physics-space coordinates (not null, unaffected)rotInB
- the orientation of the joint in B's local coordinates (rotation matrix, not null, unaffected)rotInWorld
- the orientation of the joint in physics-space coordinates (rotation matrix, not null, unaffected)linearReferenceFrame
- which end to use as the linear reference frame (not null)
-
SixDofJoint
public SixDofJoint(PhysicsRigidBody rigidBodyA, PhysicsRigidBody rigidBodyB, Vector3f pivotInA, Vector3f pivotInB, Matrix3f rotInA, Matrix3f rotInB, boolean useLinearReferenceFrameA) Instantiate a double-ended SixDofJoint.To be effective, the joint must be added to the PhysicsSpace of both bodies. Also, the bodies must be distinct and at least one of them must be dynamic.
- Parameters:
rigidBodyA
- the body for the A end (not null, alias created)rigidBodyB
- the body for the B end (not null, alias created)pivotInA
- the pivot location in A's scaled local coordinates (not null, unaffected)pivotInB
- the pivot location in B's scaled local coordinates (not null, unaffected)rotInA
- the joint orientation in A's local coordinates (rotation matrix, unaffected)rotInB
- the joint orientation in B's local coordinates (rotation matrix, unaffected)useLinearReferenceFrameA
- true→use body A, false→use body B
-
SixDofJoint
public SixDofJoint(PhysicsRigidBody rigidBodyA, PhysicsRigidBody rigidBodyB, Vector3f pivotInA, Vector3f pivotInB, boolean useLinearReferenceFrameA) Instantiate a double-ended SixDofJoint.To be effective, the joint must be added to the body's PhysicsSpace and the body must be dynamic.
- Parameters:
rigidBodyA
- the first body to constrain (not null, alias created)rigidBodyB
- the 2nd body to constrain (not null, alias created)pivotInA
- the pivot location in A's scaled local coordinates (not null, unaffected)pivotInB
- the pivot location in B's scaled local coordinates (not null, unaffected)useLinearReferenceFrameA
- true→use body A, false→use body B
-
-
Method Details
-
getAngles
Copy the joint's rotation angles.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the rotation angle for each local axis (in radians, either storeResult or a new vector, not null)
-
getAngularLowerLimit
Copy the joint's lower limits for rotation on all 3 axes.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the lower limit for each local axis (in radians, either storeResult or a new vector, not null)
-
getAngularUpperLimit
Copy the joint's upper limits for rotation on all 3 axes.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the upper limit for each local axis (in radians, either storeResult or a new vector, not null)
-
getFrameTransform
Copy the joint's frame transform relative to the specified end.- Parameters:
end
- which end (not null)storeResult
- storage for the result (modified if not null)- Returns:
- the transform of the constraint space relative to the end
-
getLinearLowerLimit
Copy the joint's lower limits for translation on all 3 axes.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the lower limit for each local axis (in radians, either storeResult or a new vector, not null)
-
getLinearUpperLimit
Copy the joint's upper limits for translation on all 3 axes.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the upper limit for each local axis (in radians, either storeResult or a new vector, not null)
-
getPivotOffset
Copy the joint's pivot offset.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the relative pivot position on each local axis (in physics-space units, either storeResult or a new vector, not null)
-
getRotationalLimitMotor
Access the indexed RotationalLimitMotor of this joint, the motor which influences rotation around the indexed axis.- Parameters:
axisIndex
- the axis index of the desired motor: 0→X, 1→Y, 2→Z- Returns:
- the pre-existing instance
-
getTranslationalLimitMotor
Access the TranslationalLimitMotor of this joint, the motor which influences translation on all 3 axes.- Returns:
- the pre-existing instance
-
setAngularLowerLimit
Alter the joint's lower limits for rotation of all 3 axes.- Parameters:
limits
- the desired lower limits (in radians, not null, unaffected)
-
setAngularUpperLimit
Alter the joint's upper limits for rotation of all 3 axes.- Parameters:
limits
- the desired upper limits (in radians, not null, unaffected)
-
setLinearLowerLimit
Alter the joint's lower limits for translation of all 3 axes.- Parameters:
vector
- the desired lower limits (not null, unaffected)
-
setLinearUpperLimit
Alter the joint's upper limits for translation of all 3 axes.- Parameters:
vector
- the desired upper limits (not null, unaffected)
-
createJoint
protected long createJoint(long bodyIdA, long bodyIdB, Vector3f pivotInA, Matrix3f rotInA, Vector3f pivotInB, Matrix3f rotInB, boolean useLinearReferenceFrameA) Create a double-endedbtGeneric6DofConstraint
.- Parameters:
bodyIdA
- the ID of the body for the A end (not zero)bodyIdB
- the ID of the body for the B end (not zero)pivotInA
- the pivot location in A's scaled local coordinates (not null, unaffected)rotInA
- the orientation of the joint in A's local coordinates (not null, unaffected)pivotInB
- the pivot location in B's scaled local coordinates (not null, unaffected)rotInB
- the orientation of the joint in B's local coordinates (not null, unaffected)useLinearReferenceFrameA
- true→use body A, false→use body B- Returns:
- the ID of the new joint
-
createJoint1
protected long createJoint1(long bodyIdB, Vector3f pivotInB, Matrix3f rotInB, boolean useLinearReferenceFrameB) Create a single-endedbtGeneric6DofConstraint
.- Parameters:
bodyIdB
- the ID of the body for the B end (not zero)pivotInB
- the pivot location in B's scaled local coordinates (not null, unaffected)rotInB
- the orientation of the joint in B's local coordinates (not null, unaffected)useLinearReferenceFrameB
- true→use body A, false→use body B- Returns:
- the ID of the new joint
-