Class NewHinge
java.lang.Object
com.jme3.bullet.NativePhysicsObject
com.jme3.bullet.joints.PhysicsJoint
com.jme3.bullet.joints.Constraint
com.jme3.bullet.joints.New6Dof
com.jme3.bullet.joints.NewHinge
- All Implemented Interfaces:
Comparable<NativePhysicsObject>
A 3 degree-of-freedom Constraint that mimics ODE's Hinge2 joint, such as
might be used to model one of the front wheels on a motor vehicle.
Rotation is enabled only for the Z and X axes, with limits on Z-axis rotation. The X axis rotates freely. Translation is enabled only for the Z axis, with a suspension spring.
Inspired by Bullet's btHinge2Constraint.
-
Field Summary
FieldsFields inherited from class Constraint
logger15, pivotA, pivotBFields inherited from class PhysicsJoint
loggerFields inherited from class NativePhysicsObject
loggerN -
Constructor Summary
ConstructorsConstructorDescriptionNewHinge(PhysicsRigidBody rigidBodyA, PhysicsRigidBody rigidBodyB, Vector3f anchor, Vector3f axis1, Vector3f axis2) Instantiate a double-ended constraint. -
Method Summary
Modifier and TypeMethodDescriptionDetermine the anchor location for body A.getAnchor2(Vector3f storeResult) Determine the anchor location for body B.floatDetermine the rotation angle for axis1.floatDetermine the rotation angle for axis2.Determine the direction of axis1.Determine the direction of axis2.final voidsetLowerLimit(float angle1Min) Alter the lower limit for axis1 rotation.final voidsetUpperLimit(float angle1Max) Alter the upper limit for axis1 rotation.Methods inherited from class New6Dof
calculatedBasisA, calculatedBasisB, calculatedOriginA, calculatedOriginB, checkRotationOrder, enableSpring, get, getAngles, getAxis, getFrameTransform, getPivotOffset, getRotationMatrix, getRotationMotor, getRotationOrder, getTranslationMotor, isMotorEnabled, isServoEnabled, isSpringEnabled, newInstance, set, setDamping, setEquilibriumPoint, setEquilibriumPoint, setEquilibriumPoint, setPivotInA, setPivotInB, setRotationOrder, setStiffnessMethods inherited from class Constraint
getAppliedImpulse, getBodyA, getBodyB, getBreakingImpulseThreshold, getConstraintType, getOverrideIterations, getPivot, getPivotA, getPivotB, isCollisionBetweenLinkedBodies, isEnabled, isFeedback, overrideIterations, setBreakingImpulseThreshold, setCollisionBetweenLinkedBodies, setEnabled, setFeedbackMethods inherited from class PhysicsJoint
countEnds, destroy, findEnd, findOtherBody, getBody, getPhysicsSpace, setBodyA, setBodyB, setNativeId, setPhysicsSpace, toStringMethods inherited from class NativePhysicsObject
compareTo, countTrackers, dumpTrackers, equals, freeUnusedObjects, hasAssignedNativeObject, hashCode, nativeId, reassignNativeId, setNativeIdNotTracked, unassignNativeObject
-
Field Details
-
logger3
message logger for this class
-
-
Constructor Details
-
NewHinge
public NewHinge(PhysicsRigidBody rigidBodyA, PhysicsRigidBody rigidBodyB, Vector3f anchor, Vector3f axis1, Vector3f axis2) Instantiate a double-ended constraint.To be effective, the constraint 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)anchor- initial anchor location for the constraint frame (in physics-space coordinates, not null, unaffected)axis1- initial Z-axis direction for the constraint frame (in physics-space coordinates, not null, not zero, unaffected)axis2- initial X-axis direction for the constraint frame (in physics-space coordinates, not null, not zero, unaffected)
-
-
Method Details
-
getAnchor
-
getAnchor2
-
getAngle1
public float getAngle1()Determine the rotation angle for axis1.- Returns:
- the rotation angle (in radians)
-
getAngle2
public float getAngle2()Determine the rotation angle for axis2.- Returns:
- the rotation angle (in radians)
-
getAxis1
-
getAxis2
-
setLowerLimit
public final void setLowerLimit(float angle1Min) Alter the lower limit for axis1 rotation.- Parameters:
angle1Min- the desired angle (in radians)
-
setUpperLimit
public final void setUpperLimit(float angle1Max) Alter the upper limit for axis1 rotation.- Parameters:
angle1Max- the desired angle (in radians)
-