Package com.jme3.bullet
Class MultiBodyLink
java.lang.Object
com.jme3.bullet.NativePhysicsObject
com.jme3.bullet.MultiBodyLink
- All Implemented Interfaces:
Comparable<NativePhysicsObject>
A single link in a MultiBody, based on Bullet's
btMultibodyLink
.-
Field Summary
Fields inherited from class com.jme3.bullet.NativePhysicsObject
loggerN
-
Method Summary
Modifier and TypeMethodDescriptionaddCollider
(CollisionShape shape) Add a collider for this link.void
addConstraintForce
(Vector3f force) Add an external force to this link.void
addConstraintTorque
(Vector3f torque) Add an external torque to this link.void
Add an external force to this link.void
addJointTorque
(int dofIndex, float torque) Add an external torque to this link's joint.void
Add an external torque to this link.appliedForce
(Vector3f storeResult) Determine the net applied force on this link.appliedTorque
(Vector3f storeResult) Determine the net applied torque on this link.Determine the direction of the joint's axis for a planar, prismatic, or revolute joint.constraintForce
(Vector3f storeResult) Determine the net constraint force on this link.constraintTorque
(Vector3f storeResult) Determine the net constraint torque on this link.int
Count the degrees of freedom in the joint.int
Count the position variables in the joint.Access the collider for this link.Access the MultiBody that contains this link.Determine the parent of this link.int
index()
Determine the index of this link in its MultiBody.Determine the rotational inertia of this link.boolean
Test whether collisions with the immediate parent link are enabled.float
jointPosition
(int dofIndex) Determine the position of the indexed DOF.float
jointTorque
(int dofIndex) Determine the torque applied to the indexed DOF usingaddJointTorque(int, float)
, which is zeroed after each simulation step.Determine the type of joint between this link and its parent.float
jointVelocity
(int dofIndex) Determine the velocity of the indexed DOF.Determine the location of this link's center of mass.float
mass()
Determine the mass of this link.orientation
(Quaternion storeResult) Determine the orientation of the link relative to its parent when Q=0.parent2Link
(Vector3f storeResult) Determine the offset of the link's center relative to its parent's center for a planar joint.parent2Pivot
(Vector3f storeResult) Determine the offset from the parent's center to the pivot for a non-planar joint.pivot2Link
(Vector3f storeResult) Determine the offset from the pivot to this link's center for a non-planar joint.void
setJointPosition
(int dofIndex, float position) Alter the position of the indexed DOF.void
setJointVelocity
(int dofIndex, float velocity) Alter the velocity of the indexed DOF.worldTransform
(Transform storeResult) Determine the transform of this link.Methods inherited from class com.jme3.bullet.NativePhysicsObject
compareTo, countTrackers, dumpTrackers, equals, freeUnusedObjects, hasAssignedNativeObject, hashCode, nativeId, reassignNativeId, setNativeId, setNativeIdNotTracked, toString, unassignNativeObject
-
Field Details
-
logger
message logger for this class
-
-
Method Details
-
addCollider
Add a collider for this link.- Parameters:
shape
- (not null, alias created)- Returns:
- a new collider
-
addConstraintForce
Add an external force to this link.- Parameters:
force
- the force to add (in physics-space coordinates, not null, unaffected)
-
addConstraintTorque
Add an external torque to this link.- Parameters:
torque
- the torque to add (in physics-space coordinates, not null, unaffected)
-
addForce
Add an external force to this link.- Parameters:
force
- the force to add (in physics-space coordinates, not null, unaffected)
-
addJointTorque
public void addJointTorque(int dofIndex, float torque) Add an external torque to this link's joint.- Parameters:
dofIndex
- which degree of freedom (≥0, <numDofs)torque
- the torque to add
-
addTorque
Add an external torque to this link.- Parameters:
torque
- the torque to add (in physics-space coordinates, not null, unaffected)
-
appliedForce
Determine the net applied force on this link.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the force vector (in physics-space coordinates, either storeResult or a new vector, not null)
-
appliedTorque
Determine the net applied torque on this link.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the torque vector (in physics-space coordinates, either storeResult or a new vector, not null)
-
axis
Determine the direction of the joint's axis for a planar, prismatic, or revolute joint.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the direction (a unit vector, either storeResult or a new vector)
-
constraintForce
Determine the net constraint force on this link.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the force vector (in physics-space coordinates, either storeResult or a new vector, not null)
-
constraintTorque
Determine the net constraint torque on this link.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the torque vector (in physics-space coordinates, either storeResult or a new vector, not null)
-
countDofs
public int countDofs()Count the degrees of freedom in the joint.- Returns:
- the count (≥0)
-
countPositionVariables
public int countPositionVariables()Count the position variables in the joint.- Returns:
- the count (≥0)
-
getCollider
Access the collider for this link.- Returns:
- the pre-existing instance, or null if none
-
getMultiBody
Access the MultiBody that contains this link.- Returns:
- the pre-existing instance (not null)
-
getParentLink
Determine the parent of this link.- Returns:
- the pre-existing instance, or null if this link's parent is the base
-
index
public int index()Determine the index of this link in its MultiBody.- Returns:
- the index (≥0)
-
inertia
Determine the rotational inertia of this link.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the principal (diagonal) components of the inertia tensor (in the link's local coordinates, either storeResult or a new vector, not null)
-
isCollisionWithParent
public boolean isCollisionWithParent()Test whether collisions with the immediate parent link are enabled.- Returns:
- true if collisions are enabled, otherwise false
-
jointPosition
public float jointPosition(int dofIndex) Determine the position of the indexed DOF.- Parameters:
dofIndex
- which degree of freedom (≥0, <numDofs)- Returns:
- the position
-
jointTorque
public float jointTorque(int dofIndex) Determine the torque applied to the indexed DOF usingaddJointTorque(int, float)
, which is zeroed after each simulation step.- Parameters:
dofIndex
- which degree of freedom (≥0, <numDofs)- Returns:
- the torque
-
jointType
Determine the type of joint between this link and its parent.- Returns:
- an enum value (not null)
-
jointVelocity
public float jointVelocity(int dofIndex) Determine the velocity of the indexed DOF.- Parameters:
dofIndex
- which degree of freedom (≥0, <numDofs)- Returns:
- the velocity
-
location
Determine the location of this link's center of mass.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the location vector (in physics-space coordinates, either storeResult or a new vector, not null)
-
mass
public float mass()Determine the mass of this link.- Returns:
- the mass (in physics-space units, >0)
-
orientation
Determine the orientation of the link relative to its parent when Q=0.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the orientation (either storeResult or a new Quaternion)
-
parent2Link
Determine the offset of the link's center relative to its parent's center for a planar joint.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the offset (in this link's coordinate system, either storeResult or a new vector)
-
parent2Pivot
Determine the offset from the parent's center to the pivot for a non-planar joint.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the offset (in the parent's coordinate system, either storeResult or a new vector)
-
pivot2Link
Determine the offset from the pivot to this link's center for a non-planar joint.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the offset (in this link's coordinate system, either storeResult or a new vector)
-
setJointPosition
public void setJointPosition(int dofIndex, float position) Alter the position of the indexed DOF.- Parameters:
dofIndex
- which degree of freedom (≥0, <numDofs)position
- the desired position
-
setJointVelocity
public void setJointVelocity(int dofIndex, float velocity) Alter the velocity of the indexed DOF.- Parameters:
dofIndex
- which degree of freedom (≥0, <numDofs)velocity
- the desired velocity
-
worldTransform
Determine the transform of this link. Assumes the physics simulation has been stepped.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- the Transform (either storeResult or a new instance, not null)
-