Package com.jme3.bullet.joints
Class HingeJoint
java.lang.Object
com.jme3.bullet.joints.PhysicsJoint
com.jme3.bullet.joints.HingeJoint
- All Implemented Interfaces:
Savable
From 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.
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.
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected Vector3f
protected Vector3f
protected float
protected float
protected float
Fields inherited from class com.jme3.bullet.joints.PhysicsJoint
collisionBetweenLinkedBodys, constraint, nodeA, nodeB, pivotA, pivotB
-
Constructor Summary
ModifierConstructorDescriptionprotected
HingeJoint
(PhysicsRigidBody nodeA, PhysicsRigidBody nodeB, Vector3f pivotA, Vector3f pivotB, Vector3f axisA, Vector3f axisB) Creates a new HingeJoint -
Method Summary
Modifier and TypeMethodDescriptionprotected void
void
enableMotor
(boolean enable, float targetVelocity, float maxMotorImpulse) Enables the motor.float
float
float
void
read
(JmeImporter im) void
setAngularOnly
(boolean angularOnly) void
setLimit
(float low, float high) Sets the limits of this joint.void
setLimit
(float low, float high, float _softness, float _biasFactor, float _relaxationFactor) Sets the limits of this joint.void
write
(JmeExporter ex) Methods inherited from class com.jme3.bullet.joints.PhysicsJoint
destroy, getAppliedImpulse, getBodyA, getBodyB, getObjectId, getPivotA, getPivotB, isCollisionBetweenLinkedBodys, setCollisionBetweenLinkedBodys
-
Field Details
-
axisA
-
axisB
-
angularOnly
protected boolean angularOnly -
biasFactor
protected float biasFactor -
relaxationFactor
protected float relaxationFactor -
limitSoftness
protected float limitSoftness
-
-
Constructor Details
-
HingeJoint
protected HingeJoint() -
HingeJoint
public HingeJoint(PhysicsRigidBody nodeA, PhysicsRigidBody nodeB, Vector3f pivotA, Vector3f pivotB, Vector3f axisA, Vector3f axisB) Creates a new HingeJoint- Parameters:
nodeA
- the body for the A end (not null, alias created)nodeB
- the body for the B end (not null, alias created)pivotA
- local translation of the joint connection point in node ApivotB
- local translation of the joint connection point in node BaxisA
- the joint axis in A's local coordinates (unit vector, alias created)axisB
- the joint axis in B's local coordinates (unit vector, alias created)
-
-
Method Details
-
enableMotor
public void enableMotor(boolean enable, float targetVelocity, float maxMotorImpulse) Enables the motor.- Parameters:
enable
- if true, motor is enabled.targetVelocity
- the target velocity of the rotation.maxMotorImpulse
- the max force applied to the hinge to rotate it.
-
setLimit
public void setLimit(float low, float high) Sets the limits of this joint.- Parameters:
low
- the low limit in radians.high
- the high limit in radians.
-
setLimit
public void setLimit(float low, float high, float _softness, float _biasFactor, float _relaxationFactor) Sets the limits of this joint. If you're above the softness, velocities that would shoot through the actual limit are slowed down. The bias be in the range of 0.2 - 0.5.- Parameters:
low
- the low limit in radians.high
- the high limit in radians._softness
- the factor at which the velocity error correction starts operating,i.e a softness of 0.9 means that the vel. corr starts at 90% of the limit range._biasFactor
- the magnitude of the position correction. It tells you how strictly the position error (drift ) is corrected._relaxationFactor
- the 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.
-
getUpperLimit
public float getUpperLimit() -
getLowerLimit
public float getLowerLimit() -
setAngularOnly
public void setAngularOnly(boolean angularOnly) -
getHingeAngle
public float getHingeAngle() -
write
- Specified by:
write
in interfaceSavable
- Overrides:
write
in classPhysicsJoint
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Overrides:
read
in classPhysicsJoint
- Throws:
IOException
-
createJoint
protected void createJoint()
-