java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.NonCopyable
com.github.stephengold.joltjni.Constraint
- All Implemented Interfaces:
ConstConstraint
,ConstJoltPhysicsObject
,RefTarget
,AutoCloseable
,Comparable<JoltPhysicsObject>
- Direct Known Subclasses:
TwoBodyConstraint
,VehicleConstraint
The abstract base class for physics constraints.
-
Method Summary
Modifier and TypeMethodDescriptionint
Return the constraint's priority when solving.Convert the constraint to aConstraintSettings
object.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.int
Count the active references to the nativeConstraint
.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.void
setConstraintPriority
(int level) Alter the constraint's priority when solving.void
Mark the nativeConstraint
as embedded.void
setEnabled
(boolean setting) Enable or disable the constraint.void
setNumPositionStepsOverride
(int setting) Alter the override for the number of position iterations used in the solver.void
setNumVelocityStepsOverride
(int setting) Alter the override for the number of velocity iterations used in the solver.toRef()
Create a counted reference to the nativeConstraint
.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
-
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)
-
setConstraintPriority
public void setConstraintPriority(int level) Alter the constraint's priority when solving.- Parameters:
level
- the desired priority level
-
setEnabled
public void setEnabled(boolean setting) Enable or disable the constraint.- Parameters:
setting
-true
to enable orfalse
to disable
-
setNumPositionStepsOverride
public void setNumPositionStepsOverride(int setting) Alter the override for the number of position iterations used in the solver.- Parameters:
setting
- the number of iterations, or 0 to use the default inPhysicsSettings
-
setNumVelocityStepsOverride
public void setNumVelocityStepsOverride(int setting) Alter the override for the number of velocity iterations used in the solver.- Parameters:
setting
- the number of iterations, or 0 to use the default inPhysicsSettings
-
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)
-
getRefCount
public int getRefCount()Count the active references to the nativeConstraint
. The constraint is unaffected.- Specified by:
getRefCount
in interfaceRefTarget
- Returns:
- the count (≥0)
-
setEmbedded
public void setEmbedded()Mark the nativeConstraint
as embedded.- Specified by:
setEmbedded
in interfaceRefTarget
-
toRef
Create a counted reference to the nativeConstraint
.
-