Package com.github.stephengold.joltjni
Class Constraint
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<ConstJoltPhysicsObject>
- Direct Known Subclasses:
TwoBodyConstraint,VehicleConstraint
The abstract base class for physics constraints.
-
Method Summary
Modifier and TypeMethodDescriptionintReturn the constraint's priority when solving.Convert the constraint to aConstraintSettingsobject.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.intCount the active references to the nativeConstraint.Return the constraint's subtype.getType()Return the constraint's type.longReturn the constraint's user data: can be used for anything.voidsetConstraintPriority(int level) Alter the constraint's priority when solving.voidMark the nativeConstraintas embedded.voidsetEnabled(boolean setting) Enable or disable the constraint.voidsetNumPositionStepsOverride(int setting) Alter the override for the number of position iterations used in the solver.voidsetNumVelocityStepsOverride(int setting) Alter the override for the number of velocity iterations used in the solver.voidsetUserData(long value) Alter the constraint's user data.toRef()Create a counted reference to the nativeConstraint.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, hasAssignedNativeObject, hashCode, ownsNativeObject, 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, va
-
Method Details
-
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 or false 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
-
setUserData
public void setUserData(long value) Alter the constraint's user data.- Parameters:
value- the desired value (default=0)
-
getConstraintPriority
public int getConstraintPriority()Return the constraint's priority when solving.- Specified by:
getConstraintPriorityin interfaceConstConstraint- Returns:
- the priority level
-
getConstraintSettings
Convert the constraint to aConstraintSettingsobject.- Specified by:
getConstraintSettingsin interfaceConstConstraint- Returns:
- a new reference to a new settings object
-
getEnabled
public boolean getEnabled()Test whether the constraint is enabled.- Specified by:
getEnabledin interfaceConstConstraint- Returns:
- true if enabled, otherwise false
-
getNumPositionStepsOverride
public int getNumPositionStepsOverride()Return the override for the number of position iterations used in the solver.- 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.- 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)
-
getUserData
public long getUserData()Return the constraint's user data: can be used for anything. The constraint is unaffected.- Specified by:
getUserDatain interfaceConstConstraint- Returns:
- the value
-
getRefCount
public int getRefCount()Count the active references to the nativeConstraint. The constraint is unaffected.- Specified by:
getRefCountin interfaceRefTarget- Returns:
- the count (≥0)
-
setEmbedded
public void setEmbedded()Mark the nativeConstraintas embedded.- Specified by:
setEmbeddedin interfaceRefTarget
-
toRef
Create a counted reference to the nativeConstraint.
-