public class HingeJoint extends Constraint
From the Bullet manual:
Hinge constraint, or revolute joint restricts two additional angular degrees
of freedom, so the body can only rotate around one axis, the hinge axis. This
can be useful to represent doors or wheels rotating around one axis. The user
can specify limits and motor for the hinge.
| Modifier and Type | Field and Description |
|---|---|
static java.util.logging.Logger |
logger2
message logger for this class
|
logger15, pivotA, pivotBloggerloggerN| Constructor and Description |
|---|
HingeJoint(PhysicsRigidBody rigidBodyA,
PhysicsRigidBody rigidBodyB,
Vector3f pivotInA,
Vector3f pivotInB,
Vector3f axisInA,
Vector3f axisInB)
Instantiate a double-ended HingeJoint.
|
HingeJoint(PhysicsRigidBody rigidBodyA,
Vector3f pivotInA,
Vector3f pivotInWorld,
Vector3f axisInA,
Vector3f axisInWorld,
JointEnd referenceFrame)
Instantiate a single-ended HingeJoint.
|
| Modifier and Type | Method and Description |
|---|---|
void |
enableMotor(boolean enable,
float targetVelocity,
float maxMotorImpulse)
Enable or disable this joint's motor.
|
float |
getBiasFactor()
Read this joint's bias factor.
|
boolean |
getEnableMotor()
Test whether this joint's motor is enabled.
|
Transform |
getFrameTransform(JointEnd end,
Transform storeResult)
Copy the joint's frame transform relative to the specified end.
|
float |
getHingeAngle()
Read the hinge angle.
|
float |
getLimitSoftness()
Read this joint's limit softness.
|
float |
getLowerLimit()
Read the lower limit of the hinge angle.
|
float |
getMaxMotorImpulse()
Read the motor's maximum impulse.
|
float |
getMotorTargetVelocity()
Read the motor's target velocity.
|
float |
getRelaxationFactor()
Read this joint's relaxation factor.
|
float |
getUpperLimit()
Read the upper limit of the hinge angle.
|
boolean |
isAngularOnly()
Test whether this joint is angular-only, meaning no constraints on
translation.
|
void |
setAngularOnly(boolean angularOnly)
Alter whether this joint is angular-only, meaning no constraints on
translation.
|
void |
setLimit(float low,
float high)
Alter the angular limits for this joint.
|
void |
setLimit(float low,
float high,
float softness,
float bias,
float relaxation)
Alter the angular limits for this joint.
|
getAppliedImpulse, getBodyA, getBodyB, getBreakingImpulseThreshold, getConstraintType, getOverrideIterations, getPivot, getPivotA, getPivotB, isCollisionBetweenLinkedBodies, isEnabled, isFeedback, overrideIterations, setBreakingImpulseThreshold, setCollisionBetweenLinkedBodies, setEnabled, setFeedback, setPivotInA, setPivotInBcountEnds, destroy, findEnd, findOtherBody, getBody, getPhysicsSpace, setBodyA, setBodyB, setNativeId, setPhysicsSpace, toStringcompareTo, countTrackers, dumpTrackers, equals, freeUnusedObjects, hasAssignedNativeObject, hashCode, nativeId, reassignNativeId, setNativeIdNotTracked, unassignNativeObjectpublic static final java.util.logging.Logger logger2
public HingeJoint(PhysicsRigidBody rigidBodyA, Vector3f pivotInA, Vector3f pivotInWorld, Vector3f axisInA, Vector3f axisInWorld, JointEnd referenceFrame)
To be effective, the joint must be added to the body's PhysicsSpace and the body must be dynamic.
rigidBodyA - the body to constrain (not null, alias created)pivotInA - the pivot location in A's scaled local coordinates (not
null, unaffected)pivotInWorld - the pivot location in physics-space coordinates (not
null, unaffected)axisInA - the joint axis in A's local coordinates (unit vector,
unaffected)axisInWorld - the joint axis in physics-space coordinates (unit
vector, unaffected)referenceFrame - which end to use as the reference frame (not null)public HingeJoint(PhysicsRigidBody rigidBodyA, PhysicsRigidBody rigidBodyB, Vector3f pivotInA, Vector3f pivotInB, Vector3f axisInA, Vector3f axisInB)
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.
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)axisInA - the joint axis in A's local coordinates (unit vector,
unaffected)axisInB - the joint axis in B's local coordinates (unit vector,
unaffected)public void enableMotor(boolean enable,
float targetVelocity,
float maxMotorImpulse)
enable - true to enable, false to disable (default=false)targetVelocity - the desired target velocitymaxMotorImpulse - the desired maximum rotational forcepublic float getBiasFactor()
public boolean getEnableMotor()
public Transform getFrameTransform(JointEnd end, Transform storeResult)
end - which end (not null)storeResult - storage for the result (modified if not null)public float getHingeAngle()
public float getLimitSoftness()
public final float getLowerLimit()
public float getMotorTargetVelocity()
public float getMaxMotorImpulse()
public float getRelaxationFactor()
public final float getUpperLimit()
public boolean isAngularOnly()
public void setAngularOnly(boolean angularOnly)
angularOnly - true→translation is free, false→translation
is constrained (default=false)public void setLimit(float low,
float high)
low - the desired lower limit of the hinge angle (in radians,
default=1)high - the desired upper limit of the hinge angle (in radians,
default=-1)public void setLimit(float low,
float high,
float softness,
float bias,
float relaxation)
If you're above the softness, velocities that would shoot through the actual limit are slowed down. The bias should be in the range of 0.2 - 0.5.
low - the desired lower limit of the hinge angle (in radians,
default=1)high - the desired upper limit of the hinge angle (in radians,
default=-1)softness - the desired range fraction at which velocity-error
correction starts operating. A softness of 0.9 means that the correction
starts at 90% of the limit range. (default=0.9)bias - the desired magnitude of the position correction: how
strictly position errors (drift) are corrected (default=0.3)relaxation - the desired rate at which velocity errors are
corrected. This can be seen as the strength of the limits. A low value
will make the limits more spongy. (default=1)