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

public class RodBendTwist extends JoltPhysicsObject implements ConstRodBendTwist
Join 2 soft-body Cosserat rods with limited bending and twisting. (native type: SoftBodySharedSettings::RodBendTwist)
  • Constructor Details

    • RodBendTwist

      public RodBendTwist()
      Instantiate a default constraint.
    • RodBendTwist

      public RodBendTwist(int rod0, int rod1)
      Instantiate a constraint joining the specified rods with infinite stiffness.
      Parameters:
      rod0 - the index of the first rod (≥0)
      rod1 - the index of the 2nd rod (≥0)
    • RodBendTwist

      public RodBendTwist(int rod0, int rod1, float compliance)
      Instantiate a constraint joining the specified rods with the specified stiffness.
      Parameters:
      rod0 - the index of the first rod (≥0)
      rod1 - the index of the 2nd rod (≥0)
      compliance - the inverse of the desired stiffness (default=0)
  • Method Details

    • setCompliance

      public RodBendTwist setCompliance(float compliance)
      Alter the stiffness of the constraint. (native attribute: mCompliance)
      Parameters:
      compliance - the inverse of the desired stiffness (default=0)
      Returns:
      the modified settings, for chaining
    • setOmega0

      public RodBendTwist setOmega0(QuatArg omega0)
      Alter the Omega0 rotation of the constraint. (native attribute: mOmega0)
      Parameters:
      omega0 - the desired rotation (not null, unaffected)
      Returns:
      the modified settings, for chaining
    • setRod

      public RodBendTwist setRod(int indexInConstraint, int indexInMesh)
      Assign the specified rod to the constraint. (native attribute: mRod)
      Parameters:
      indexInConstraint - which end of the constraint (0 or 1)
      indexInMesh - the index of the rod to assign (≥0)
      Returns:
      the modified settings, for chaining
    • getCompliance

      public float getCompliance()
      Return the inverse of the spring's stiffness. The constraint is unaffected. (native attribute: mCompliance)
      Specified by:
      getCompliance in interface ConstRodBendTwist
      Returns:
      the compliance value
    • getOmega0

      public Quat getOmega0()
      Return the Omega0 rotation of the constraint. The constraint is unaffected. (native attribute: mOmega0)
      Specified by:
      getOmega0 in interface ConstRodBendTwist
      Returns:
      a new quaternion
    • getRod

      public int getRod(int indexInConstraint)
      Return the rod at the specified end. The constraint is unaffected. (native attribute: mRod)
      Specified by:
      getRod in interface ConstRodBendTwist
      Parameters:
      indexInConstraint - which end of the constraint (0 or 1)
      Returns:
      the index of the rod (≥0)