java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.RodBendTwist
- All Implemented Interfaces:
ConstJoltPhysicsObject
,ConstRodBendTwist
,AutoCloseable
,Comparable<JoltPhysicsObject>
Join 2 soft-body Cosserat rods with limited bending and twisting. (native
type:
SoftBodySharedSettings::RodBendTwist
)-
Constructor Summary
ConstructorsConstructorDescriptionInstantiate a default constraint.RodBendTwist
(int rod0, int rod1) Instantiate a constraint joining the specified rods with infinite stiffness.RodBendTwist
(int rod0, int rod1, float compliance) Instantiate a constraint joining the specified rods with the specified stiffness. -
Method Summary
Modifier and TypeMethodDescriptionfloat
Return the inverse of the spring's stiffness.Return the Omega0 rotation of the constraint.int
getRod
(int indexInConstraint) Return the rod at the specified end.setCompliance
(float compliance) Alter the stiffness of the constraint.Alter the Omega0 rotation of the constraint.setRod
(int indexInConstraint, int indexInMesh) Assign the specified rod to the constraint.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
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
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
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
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 interfaceConstRodBendTwist
- Returns:
- the compliance value
-
getOmega0
Return the Omega0 rotation of the constraint. The constraint is unaffected. (native attribute: mOmega0)- Specified by:
getOmega0
in interfaceConstRodBendTwist
- 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 interfaceConstRodBendTwist
- Parameters:
indexInConstraint
- which end of the constraint (0 or 1)- Returns:
- the index of the rod (≥0)
-