Class ConnectedConstraint

java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.ConnectedConstraint
All Implemented Interfaces:
ConstConnectedConstraint, ConstJoltPhysicsObject, AutoCloseable, Comparable<JoltPhysicsObject>

public class ConnectedConstraint extends JoltPhysicsObject implements ConstConnectedConstraint
A constraint in a scene and which bodies it connects to. (native type: PhysicsScene::ConnectedConstraint)
  • Constructor Details

    • ConnectedConstraint

      public ConnectedConstraint()
      Instantiate a default constraint.
    • ConnectedConstraint

      public ConnectedConstraint(ConstConnectedConstraint original)
      Instantiate a copy of the specified box.
      Parameters:
      original - the box to copy (not null, unaffected)
    • ConnectedConstraint

      public ConnectedConstraint(TwoBodyConstraintSettings settings, int body1, int body2)
      Instantiate a constraint with the specified settings and bodies.
      Parameters:
      settings - the desired constraint settings (not null, unaffected)
      body1 - the index of the desired first body (default=0)
      body2 - the index of the desired 2nd body (default=0)
  • Method Details

    • set

      Copy the argument to the current constraint.
      Parameters:
      source - the constraint to copy (not null, unaffected)
      Returns:
      the modified constraint, for chaining
    • setBody1

      public ConnectedConstraint setBody1(int body1)
      Alter the index of the first body. (native attribute: mBody1)
      Parameters:
      body1 - the index of the desired first body (default=0)
      Returns:
      the modified constraint, for chaining
    • setBody2

      public ConnectedConstraint setBody2(int body2)
      Alter the index of the 2nd body. (native attribute: mBody2)
      Parameters:
      body2 - the index of the desired 2nd body (default=0)
      Returns:
      the modified constraint, for chaining
    • setSettings

      public ConnectedConstraint setSettings(TwoBodyConstraintSettings settings)
      Replace the constraint settings. (native attribute: mSettings)
      Parameters:
      settings - the desired settings (not null, unaffected, default=null)
      Returns:
      the modified constraint, for chaining
    • getBody1

      public int getBody1()
      Return the index of the first body. (native attribute: mBody1)
      Specified by:
      getBody1 in interface ConstConnectedConstraint
      Returns:
      the index of the first body
    • getBody2

      public int getBody2()
      Return the index of the 2nd body. (native attribute: mBody2)
      Specified by:
      getBody2 in interface ConstConnectedConstraint
      Returns:
      the index of the 2nd body
    • getSettings

      public TwoBodyConstraintSettings getSettings()
      Access the constraint settings. (native attribute: mSettings)
      Specified by:
      getSettings in interface ConstConnectedConstraint
      Returns:
      a new JVM object with the pre-existing native object assigned