Class MultiBodyLink

All Implemented Interfaces:
Comparable<NativePhysicsObject>

public class MultiBodyLink extends NativePhysicsObject
A single link in a MultiBody, based on Bullet's btMultibodyLink.
  • Field Details

    • logger

      public static final Logger logger
      message logger for this class
  • Method Details

    • addCollider

      public MultiBodyCollider addCollider(CollisionShape shape)
      Add a collider for this link.
      Parameters:
      shape - (not null, alias created)
      Returns:
      a new collider
    • addConstraintForce

      public void addConstraintForce(Vector3f force)
      Add an external force to this link.
      Parameters:
      force - the force to add (in physics-space coordinates, not null, unaffected)
    • addConstraintTorque

      public void addConstraintTorque(Vector3f torque)
      Add an external torque to this link.
      Parameters:
      torque - the torque to add (in physics-space coordinates, not null, unaffected)
    • addForce

      public void addForce(Vector3f force)
      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

      public void addTorque(Vector3f torque)
      Add an external torque to this link.
      Parameters:
      torque - the torque to add (in physics-space coordinates, not null, unaffected)
    • appliedForce

      public Vector3f appliedForce(Vector3f storeResult)
      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

      public Vector3f appliedTorque(Vector3f storeResult)
      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

      public Vector3f axis(Vector3f storeResult)
      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

      public Vector3f constraintForce(Vector3f storeResult)
      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

      public Vector3f constraintTorque(Vector3f storeResult)
      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

      public MultiBodyCollider getCollider()
      Access the collider for this link.
      Returns:
      the pre-existing instance, or null if none
    • getMultiBody

      public MultiBody getMultiBody()
      Access the MultiBody that contains this link.
      Returns:
      the pre-existing instance (not null)
    • getParentLink

      public MultiBodyLink 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

      public Vector3f inertia(Vector3f storeResult)
      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 using addJointTorque(int, float), which is zeroed after each simulation step.
      Parameters:
      dofIndex - which degree of freedom (≥0, <numDofs)
      Returns:
      the torque
    • jointType

      public MultiBodyJointType 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

      public Vector3f location(Vector3f storeResult)
      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

      public Quaternion orientation(Quaternion storeResult)
      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

      public Vector3f parent2Link(Vector3f storeResult)
      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

      public Vector3f parent2Pivot(Vector3f storeResult)
      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

      public Vector3f pivot2Link(Vector3f storeResult)
      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

      public Transform worldTransform(Transform storeResult)
      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)