Package com.jme3.bullet.joints
Class GearJoint
java.lang.Object
com.jme3.bullet.NativePhysicsObject
com.jme3.bullet.joints.PhysicsJoint
com.jme3.bullet.joints.Constraint
com.jme3.bullet.joints.GearJoint
- All Implemented Interfaces:
Comparable<NativePhysicsObject>
A joint that couples the angular velocities of two bodies, based on Bullet's
btGearConstraint.
From the Bullet manual:
The btGearConstraint will couple the angular velocity for two bodies around given local axis and ratio.
-
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
ConstructorDescriptionGearJoint
(PhysicsRigidBody rigidBodyA, PhysicsRigidBody rigidBodyB, Vector3f axisInA, Vector3f axisInB) Instantiate a double-ended GearJoint with a 1:1 ratio.GearJoint
(PhysicsRigidBody rigidBodyA, PhysicsRigidBody rigidBodyB, Vector3f axisInA, Vector3f axisInB, float ratio) Instantiate a double-ended GearJoint with the specified gear ratio. -
Method Summary
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
-
GearJoint
public GearJoint(PhysicsRigidBody rigidBodyA, PhysicsRigidBody rigidBodyB, Vector3f axisInA, Vector3f axisInB) Instantiate a double-ended GearJoint with a 1:1 ratio.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)axisInA
- the A body's axis of rotation in its local coordinates (unit vector, not null, unaffected)axisInB
- the B body's axis of rotation in its local coordinates (unit vector, not null, unaffected)
-
GearJoint
public GearJoint(PhysicsRigidBody rigidBodyA, PhysicsRigidBody rigidBodyB, Vector3f axisInA, Vector3f axisInB, float ratio) Instantiate a double-ended GearJoint with the specified gear ratio.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)axisInA
- the A body's axis of rotation in its local coordinates (unit vector, not null, unaffected)axisInB
- the B body's axis of rotation in its local coordinates (unit vector, not null, unaffected)ratio
- the number of revolutions the A body should make for each revolution of the B body
-
-
Method Details
-
getAxisA
Copy A body's axis of rotation.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the A body's axis of rotation in its local coordinates (either storeResult or new vector)
-
getAxisB
Copy the B body's axis of rotation.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the B body's axis of rotation in its local coordinates (either storeResult or new vector)
-
getRatio
public float getRatio()Get the gear ratio.- Returns:
- the number of revolutions the A body makes for each revolution of the B body
-
setAxisA
Alter the A body's axis of rotation.- Parameters:
axisInA
- the desired axis in local coordinates (unit vector, not null, unaffected)
-
setAxisB
Alter the B body's axis of rotation.- Parameters:
axisInB
- the axisInB axis in local coordinates (unit vector, not null, unaffected)
-
setRatio
public void setRatio(float ratio) Alter the joint's gear ratio.- Parameters:
ratio
- the number of revolutions the A body should make for each revolution of the B body (default=1)
-