Class TwoBodyConstraint

All Implemented Interfaces:
ConstConstraint, ConstJoltPhysicsObject, ConstTwoBodyConstraint, RefTarget, AutoCloseable, Comparable<JoltPhysicsObject>
Direct Known Subclasses:
ConeConstraint, DistanceConstraint, FixedConstraint, GearConstraint, HingeConstraint, PathConstraint, PointConstraint, PulleyConstraint, RackAndPinionConstraint, SixDofConstraint, SliderConstraint, SwingTwistConstraint

public abstract class TwoBodyConstraint extends Constraint implements ConstTwoBodyConstraint
A type of Constraint that joins 2 bodies.
  • Method Details

    • toRef

      public TwoBodyConstraintRef toRef()
      Create a counted reference to the native TwoBodyConstraint.
      Specified by:
      toRef in interface RefTarget
      Overrides:
      toRef in class Constraint
      Returns:
      a new JVM object with a new native object assigned
    • 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