Class TwoBodyConstraintRef

All Implemented Interfaces:
ConstConstraint, ConstJoltPhysicsObject, ConstTwoBodyConstraint, AutoCloseable, Comparable<JoltPhysicsObject>

public final class TwoBodyConstraintRef extends Ref implements ConstTwoBodyConstraint
A counted reference to a TwoBodyConstraint. (native type: Ref<TwoBodyConstraint>)
  • Constructor Details

    • TwoBodyConstraintRef

      public TwoBodyConstraintRef()
      Instantiate an empty reference.
  • Method Details

    • notifyShapeChanged

      public void notifyShapeChanged(int bodyId, Vec3Arg deltaCom)
      Notify the constraint that the shape of the specified body has changed and its center of mass has shifted by deltaCom.
      Parameters:
      bodyId - the ID of the body that changed
      deltaCom - the offset of the shift (not null, unaffected)
    • getBody1

      public Body getBody1()
      Access the first body in the constraint. The constraint is unaffected.
      Specified by:
      getBody1 in interface ConstTwoBodyConstraint
      Returns:
      a new JVM object with the pre-existing native object assigned
    • getBody2

      public Body getBody2()
      Access the 2nd body in the constraint. The constraint is unaffected.
      Specified by:
      getBody2 in interface ConstTwoBodyConstraint
      Returns:
      a new JVM object with the pre-existing native object assigned
    • getConstraintToBody1Matrix

      public Mat44 getConstraintToBody1Matrix()
      Calculate the coordinate transform from constraint space to body 1. The constraint is unaffected.
      Specified by:
      getConstraintToBody1Matrix in interface ConstTwoBodyConstraint
      Returns:
      a new transform matrix
    • getConstraintToBody2Matrix

      public Mat44 getConstraintToBody2Matrix()
      Calculate the coordinate transform from constraint space to body 2. The constraint is unaffected.
      Specified by:
      getConstraintToBody2Matrix in interface ConstTwoBodyConstraint
      Returns:
      a new transform matrix
    • getConstraintPriority

      public int getConstraintPriority()
      Return the constraint's priority when solving. The constraint is unaffected.
      Specified by:
      getConstraintPriority in interface ConstConstraint
      Returns:
      the priority level
    • getConstraintSettings

      public ConstraintSettingsRef getConstraintSettings()
      Convert the constraint to a ConstraintSettings object. The constraint is unaffected.
      Specified by:
      getConstraintSettings in interface ConstConstraint
      Returns:
      a new reference to a new settings object
    • getEnabled

      public boolean getEnabled()
      Test whether the constraint is enabled. The constraint is unaffected.
      Specified by:
      getEnabled in interface ConstConstraint
      Returns:
      true if enabled, otherwise false
    • getNumPositionStepsOverride

      public int getNumPositionStepsOverride()
      Return the override for the number of position iterations used in the solver. The constraint is unaffected.
      Specified by:
      getNumPositionStepsOverride in interface ConstConstraint
      Returns:
      the number of iterations, or 0 to use the default in PhysicsSettings
    • getNumVelocityStepsOverride

      public int getNumVelocityStepsOverride()
      Return the override for the number of velocity iterations used in the solver. The constraint is unaffected.
      Specified by:
      getNumVelocityStepsOverride in interface ConstConstraint
      Returns:
      the number of iterations, or 0 to use the default in PhysicsSettings
    • getSubType

      public EConstraintSubType getSubType()
      Return the constraint's subtype. The constraint is unaffected.
      Specified by:
      getSubType in interface ConstConstraint
      Returns:
      an enum value (not null)
    • getType

      public EConstraintType getType()
      Return the constraint's type. The constraint is unaffected.
      Specified by:
      getType in interface ConstConstraint
      Returns:
      an enum value (not null)
    • getPtr

      public TwoBodyConstraint getPtr()
      Temporarily access the referenced TwoBodyConstraint.
      Specified by:
      getPtr in class Ref
      Returns:
      a new JVM object with the pre-existing native object assigned
    • targetVa

      public long targetVa()
      Return the address of the native TwoBodyConstraint. No objects are affected.
      Specified by:
      targetVa in interface ConstJoltPhysicsObject
      Overrides:
      targetVa in class JoltPhysicsObject
      Returns:
      a virtual address (not zero)
    • toRef

      public TwoBodyConstraintRef toRef()
      Create another counted reference to the native TwoBodyConstraint.
      Specified by:
      toRef in class Ref
      Returns:
      a new JVM object with a new native object assigned