public class HingeJoint extends PhysicsJoint
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 |
---|---|
protected boolean |
angularOnly
copy of the angular-only flag (default=false)
|
protected Vector3f |
axisA |
protected Vector3f |
axisB |
protected float |
biasFactor
copy of the limit's bias factor, how strictly position errors (drift) is
corrected (default=0.3)
|
protected float |
limitSoftness
copy of the limit's softness, the range fraction at which velocity-error
correction starts operating (default=0.9)
|
protected float |
relaxationFactor
copy of the limit's relaxation factor, the rate at which velocity errors
are corrected (default=1)
|
collisionBetweenLinkedBodys, nodeA, nodeB, objectId, pivotA, pivotB
Modifier | Constructor and Description |
---|---|
protected |
HingeJoint()
No-argument constructor needed by SavableClassUtil.
|
|
HingeJoint(PhysicsRigidBody nodeA,
PhysicsRigidBody nodeB,
Vector3f pivotA,
Vector3f pivotB,
Vector3f axisA,
Vector3f axisB)
Instantiate a HingeJoint.
|
Modifier and Type | Method and Description |
---|---|
protected void |
createJoint()
Create the configured joint in Bullet.
|
void |
enableMotor(boolean enable,
float targetVelocity,
float maxMotorImpulse)
Enable or disable this joint's motor.
|
boolean |
getEnableMotor()
Test whether this joint's motor is enabled.
|
float |
getHingeAngle()
Read the hinge angle.
|
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 |
getUpperLimit()
Read the upper limit of the hinge angle.
|
void |
read(JmeImporter im)
De-serialize this joint, for example when loading from a J3O file.
|
void |
setAngularOnly(boolean angularOnly)
Alter the hinge translation flag.
|
void |
setLimit(float low,
float high)
Alter this joint's limits.
|
void |
setLimit(float low,
float high,
float _softness,
float _biasFactor,
float _relaxationFactor)
Alter this joint's limits.
|
void |
write(JmeExporter ex)
Serialize this joint, for example when saving to a J3O file.
|
destroy, finalize, getAppliedImpulse, getBodyA, getBodyB, getObjectId, getPivotA, getPivotB, isCollisionBetweenLinkedBodys, setCollisionBetweenLinkedBodys
protected Vector3f axisA
protected Vector3f axisB
protected boolean angularOnly
protected float biasFactor
protected float relaxationFactor
protected float limitSoftness
protected HingeJoint()
public HingeJoint(PhysicsRigidBody nodeA, PhysicsRigidBody nodeB, Vector3f pivotA, Vector3f pivotB, Vector3f axisA, Vector3f axisB)
nodeA
- the 1st body connected by the joint (not null, alias
created)nodeB
- the 2nd body connected by the joint (not null, alias
created)pivotA
- the local offset of the connection point in node A (not
null, alias created)pivotB
- the local offset of the connection point in node B (not
null, alias created)axisA
- the local axis of the connection to node A (not null, alias
created)axisB
- the local axis of the connection to node B (not null, alias
created)public void enableMotor(boolean enable, float targetVelocity, float maxMotorImpulse)
enable
- true to enable, false to disabletargetVelocity
- the desired target velocitymaxMotorImpulse
- the desired maximum rotational forcepublic boolean getEnableMotor()
public float getMotorTargetVelocity()
public float getMaxMotorImpulse()
public void setLimit(float low, float high)
low
- the desired lower limit of the hinge angle (in radians)high
- the desired upper limit of the joint angle (in radians)public void setLimit(float low, float high, float _softness, float _biasFactor, float _relaxationFactor)
low
- the desired lower limit of the hinge angle (in radians)high
- the desired upper limit of the joint angle (in radians)_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)_biasFactor
- the desired magnitude of the position correction, how
strictly position errors (drift) is corrected. (default=0.3)_relaxationFactor
- 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)public float getUpperLimit()
public float getLowerLimit()
public void setAngularOnly(boolean angularOnly)
angularOnly
- true→rotate only, false→rotate and translate
(default=false)public float getHingeAngle()
public void write(JmeExporter ex) throws java.io.IOException
write
in interface Savable
write
in class PhysicsJoint
ex
- exporter (not null)java.io.IOException
- from exporterpublic void read(JmeImporter im) throws java.io.IOException
read
in interface Savable
read
in class PhysicsJoint
im
- importer (not null)java.io.IOException
- from importerprotected void createJoint()