Package com.jme3.bullet.joints
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
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
ConstructorDescriptionNewHinge
(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.float
Determine the rotation angle for axis1.float
Determine the rotation angle for axis2.Determine the direction of axis1.Determine the direction of axis2.final void
setLowerLimit
(float angle1Min) Alter the lower limit for axis1 rotation.final void
setUpperLimit
(float angle1Max) Alter the upper limit for axis1 rotation.Methods inherited from class com.jme3.bullet.joints.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, setStiffness
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
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
-
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
Determine the anchor location for body A.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the location (either storeResult or a new vector, not null)
-
getAnchor2
Determine the anchor location for body B.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the location (either storeResult or a new vector, not null)
-
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
Determine the direction of axis1.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- a direction vector (either storeResult or a new vector, not null)
-
getAxis2
Determine the direction of axis2.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- a direction vector (either storeResult or a new vector, not null)
-
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)
-