Package com.github.stephengold.joltjni
Class TwoBodyConstraintRef
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.template.Ref
com.github.stephengold.joltjni.TwoBodyConstraintRef
- All Implemented Interfaces:
ConstConstraint
,ConstJoltPhysicsObject
,ConstTwoBodyConstraint
,AutoCloseable
,Comparable<JoltPhysicsObject>
A counted reference to a
TwoBodyConstraint
. (native type:
Ref<TwoBodyConstraint>
)-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetBody1()
Access the first body in the constraint.getBody2()
Access the 2nd body in the constraint.int
Return the constraint's priority when solving.Convert the constraint to aConstraintSettings
object.Calculate the coordinate transform from constraint space to body 1.Calculate the coordinate transform from constraint space to body 2.boolean
Test whether the constraint is enabled.int
Return the override for the number of position iterations used in the solver.int
Return the override for the number of velocity iterations used in the solver.getPtr()
Temporarily access the referencedTwoBodyConstraint
.Return the constraint's subtype.getType()
Return the constraint's type.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.long
targetVa()
Return the address of the nativeTwoBodyConstraint
.toRef()
Create another counted reference to the nativeTwoBodyConstraint
.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, 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
-
Constructor Details
-
TwoBodyConstraintRef
public TwoBodyConstraintRef()Instantiate an empty reference.
-
-
Method Details
-
notifyShapeChanged
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 changeddeltaCom
- the offset of the shift (not null, unaffected)
-
getBody1
Access the first body in the constraint. The constraint is unaffected.- Specified by:
getBody1
in interfaceConstTwoBodyConstraint
- Returns:
- a new JVM object with the pre-existing native object assigned
-
getBody2
Access the 2nd body in the constraint. The constraint is unaffected.- Specified by:
getBody2
in interfaceConstTwoBodyConstraint
- Returns:
- a new JVM object with the pre-existing native object assigned
-
getConstraintToBody1Matrix
Calculate the coordinate transform from constraint space to body 1. The constraint is unaffected.- Specified by:
getConstraintToBody1Matrix
in interfaceConstTwoBodyConstraint
- Returns:
- a new transform matrix
-
getConstraintToBody2Matrix
Calculate the coordinate transform from constraint space to body 2. The constraint is unaffected.- Specified by:
getConstraintToBody2Matrix
in interfaceConstTwoBodyConstraint
- Returns:
- a new transform matrix
-
getConstraintPriority
public int getConstraintPriority()Return the constraint's priority when solving. The constraint is unaffected.- Specified by:
getConstraintPriority
in interfaceConstConstraint
- Returns:
- the priority level
-
getConstraintSettings
Convert the constraint to aConstraintSettings
object. The constraint is unaffected.- Specified by:
getConstraintSettings
in interfaceConstConstraint
- 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 interfaceConstConstraint
- Returns:
true
if enabled, otherwisefalse
-
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 interfaceConstConstraint
- 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 interfaceConstConstraint
- Returns:
- the number of iterations, or 0 to use the default in
PhysicsSettings
-
getSubType
Return the constraint's subtype. The constraint is unaffected.- Specified by:
getSubType
in interfaceConstConstraint
- Returns:
- an enum value (not null)
-
getType
Return the constraint's type. The constraint is unaffected.- Specified by:
getType
in interfaceConstConstraint
- Returns:
- an enum value (not null)
-
getPtr
Temporarily access the referencedTwoBodyConstraint
. -
targetVa
public long targetVa()Return the address of the nativeTwoBodyConstraint
. No objects are affected.- Specified by:
targetVa
in interfaceConstJoltPhysicsObject
- Overrides:
targetVa
in classJoltPhysicsObject
- Returns:
- a virtual address (not zero)
-
toRef
Create another counted reference to the nativeTwoBodyConstraint
.
-