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.voidgetBody1PivotLocation(DoubleBuffer storeResult) Copy the first body's pivot location.getBody2()Access the 2nd body in the constraint.voidgetBody2PivotLocation(DoubleBuffer storeResult) Copy the 2nd body's pivot location.intReturn the constraint's priority when solving.Convert the constraint to aConstraintSettingsobject.Calculate the coordinate transform from constraint space to body 1.Calculate the coordinate transform from constraint space to body 2.booleanTest whether the constraint is enabled.intReturn the override for the number of position iterations used in the solver.intReturn 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.booleanisActive()Test whether the constraint is active.voidnotifyShapeChanged(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.voidsaveState(StateRecorder recorder) Save the state of the constraint, for possible replay.longtargetVa()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, isCleanerStarted, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, toString, vaMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods 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:
getBody1in interfaceConstTwoBodyConstraint- Returns:
- a new JVM object with the pre-existing native object assigned
-
getBody1PivotLocation
Copy the first body's pivot location. The constraint is unaffected.- Specified by:
getBody1PivotLocationin interfaceConstTwoBodyConstraint- Parameters:
storeResult- storage for the location in system coordinates (not null, modified)
-
getBody2
Access the 2nd body in the constraint. The constraint is unaffected.- Specified by:
getBody2in interfaceConstTwoBodyConstraint- Returns:
- a new JVM object with the pre-existing native object assigned
-
getBody2PivotLocation
Copy the 2nd body's pivot location. The constraint is unaffected.- Specified by:
getBody2PivotLocationin interfaceConstTwoBodyConstraint- Parameters:
storeResult- storage for the location in system coordinates (not null, modified)
-
getConstraintToBody1Matrix
Calculate the coordinate transform from constraint space to body 1. The constraint is unaffected.- Specified by:
getConstraintToBody1Matrixin interfaceConstTwoBodyConstraint- Returns:
- a new transform matrix
-
getConstraintToBody2Matrix
Calculate the coordinate transform from constraint space to body 2. The constraint is unaffected.- Specified by:
getConstraintToBody2Matrixin interfaceConstTwoBodyConstraint- Returns:
- a new transform matrix
-
getConstraintPriority
public int getConstraintPriority()Return the constraint's priority when solving. The constraint is unaffected.- Specified by:
getConstraintPriorityin interfaceConstConstraint- Returns:
- the priority level
-
getConstraintSettings
Convert the constraint to aConstraintSettingsobject. The constraint is unaffected.- Specified by:
getConstraintSettingsin 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:
getEnabledin interfaceConstConstraint- Returns:
trueif 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:
getNumPositionStepsOverridein 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:
getNumVelocityStepsOverridein 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:
getSubTypein interfaceConstConstraint- Returns:
- an enum value (not null)
-
getType
Return the constraint's type. The constraint is unaffected.- Specified by:
getTypein interfaceConstConstraint- Returns:
- an enum value (not null)
-
isActive
public boolean isActive()Test whether the constraint is active. The constraint is unaffected.- Specified by:
isActivein interfaceConstConstraint- Returns:
trueif active, otherwisefalse
-
saveState
Save the state of the constraint, for possible replay. The constraint is unaffected.- Specified by:
saveStatein interfaceConstConstraint- Parameters:
recorder- the recorder to write to (not null)
-
getPtr
Temporarily access the referencedTwoBodyConstraint. -
targetVa
public long targetVa()Return the address of the nativeTwoBodyConstraint. No objects are affected.- Specified by:
targetVain interfaceConstJoltPhysicsObject- Overrides:
targetVain classJoltPhysicsObject- Returns:
- a virtual address (not zero)
-
toRef
Create another counted reference to the nativeTwoBodyConstraint.
-