Package com.github.stephengold.joltjni
Class ConstraintSettings
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.SerializableObject
com.github.stephengold.joltjni.ConstraintSettings
- All Implemented Interfaces:
ConstConstraintSettings,ConstJoltPhysicsObject,ConstSerializableObject,RefTarget,AutoCloseable,Comparable<JoltPhysicsObject>
- Direct Known Subclasses:
TwoBodyConstraintSettings,VehicleConstraintSettings
public abstract class ConstraintSettings
extends SerializableObject
implements ConstConstraintSettings
Settings used to construct a
Constraint.-
Method Summary
Modifier and TypeMethodDescriptionintReturn the constraint's priority when solving.intReturn the constraint's controller type.floatReturn the size of the constraint in debug renders.booleanTest whether the constraint will be enabled initially.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 nativeConstraintSettings.voidsaveBinaryState(StreamOut stream) Save the settings to the specified binary stream.voidsetConstraintPriority(int level) Alter the constraint's priority when solving.voidsetDrawConstraintSize(float size) Alter the size of constraint in debug renders.voidMark the nativeConstraintSettingsas embedded.voidsetEnabled(boolean setting) Initially 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.protected final voidsetVirtualAddressAsCoOwner(long settingsVa, EConstraintSubType constraintSubType) Assign a native object (assuming there's none already assigned), designate the JVM object as a co-owner, and assign a subtype.static ConstraintResultsRestoreFromBinaryState(StreamIn stream) Read a settings object from the specified binary stream.toRef()Create a counted reference to the nativeConstraintSettings.Methods inherited from class com.github.stephengold.joltjni.SerializableObject
getRttiMethods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, isCleanerStarted, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, 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, targetVaMethods inherited from interface com.github.stephengold.joltjni.readonly.ConstSerializableObject
getRtti
-
Method Details
-
setConstraintPriority
public void setConstraintPriority(int level) Alter the constraint's priority when solving. (native attribute: mConstraintPriority)- Parameters:
level- the desired priority level (default=0)
-
setDrawConstraintSize
public void setDrawConstraintSize(float size) Alter the size of constraint in debug renders. (native attribute: mDrawConstraintSize)- Parameters:
size- the desired size (default=1)
-
setEnabled
public void setEnabled(boolean setting) Initially enable or disable the constraint. (native attribute: mEnabled)- Parameters:
setting-trueto enable orfalseto disable (default=true)
-
setNumPositionStepsOverride
public void setNumPositionStepsOverride(int setting) Alter the override for the number of position iterations used in the solver. (native attribute: mNumPositionStepsOverride)- Parameters:
setting- the number of iterations, or 0 to use the default inPhysicsSettings(default=0)
-
setNumVelocityStepsOverride
public void setNumVelocityStepsOverride(int setting) Alter the override for the number of velocity iterations used in the solver. (native attribute: mNumVelocityStepsOverride)- Parameters:
setting- the number of iterations, or 0 to use the default inPhysicsSettings(default=0)
-
sRestoreFromBinaryState
Read a settings object from the specified binary stream.- Parameters:
stream- where to read objects (not null)- Returns:
- a new object
-
setVirtualAddressAsCoOwner
protected final void setVirtualAddressAsCoOwner(long settingsVa, EConstraintSubType constraintSubType) Assign a native object (assuming there's none already assigned), designate the JVM object as a co-owner, and assign a subtype.- Parameters:
settingsVa- the virtual address of the native object to assign (not zero)constraintSubType- the desired subtype (not null)
-
getConstraintPriority
public int getConstraintPriority()Return the constraint's priority when solving. The settings are unaffected. (native attribute: mConstraintPriority)- Specified by:
getConstraintPriorityin interfaceConstConstraintSettings- Returns:
- the priority level
-
getControllerType
public int getControllerType()Return the constraint's controller type. The settings are unaffected.- Specified by:
getControllerTypein interfaceConstConstraintSettings- Returns:
- a numeric code, such as
VehicleController.motorcycleType
-
getDrawConstraintSize
public float getDrawConstraintSize()Return the size of the constraint in debug renders. The settings are unaffected. (native attribute: mDrawConstraintSize)- Specified by:
getDrawConstraintSizein interfaceConstConstraintSettings- Returns:
- the size
-
getEnabled
public boolean getEnabled()Test whether the constraint will be enabled initially. The settings are unaffected. (native attribute: mEnabled)- Specified by:
getEnabledin interfaceConstConstraintSettings- Returns:
trueif enabled, otherwisefalse
-
getNumPositionStepsOverride
public int getNumPositionStepsOverride()Return the override for the number of position iterations used in the solver. The settings are unaffected. (native attribute: mNumPositionStepsOverride)- Specified by:
getNumPositionStepsOverridein interfaceConstConstraintSettings- 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 settings are unaffected. (native attribute: mNumVelocityStepsOverride)- Specified by:
getNumVelocityStepsOverridein interfaceConstConstraintSettings- Returns:
- the number of iterations, or 0 to use the default configured in
PhysicsSettings
-
saveBinaryState
Save the settings to the specified binary stream. The settings are unaffected.- Specified by:
saveBinaryStatein interfaceConstConstraintSettings- Parameters:
stream- the stream to write to (not null)
-
getRefCount
public int getRefCount()Count the active references to the nativeConstraintSettings. The settings are unaffected.- Specified by:
getRefCountin interfaceRefTarget- Returns:
- the count (≥0)
-
setEmbedded
public void setEmbedded()Mark the nativeConstraintSettingsas embedded.- Specified by:
setEmbeddedin interfaceRefTarget
-
toRef
Create a counted reference to the nativeConstraintSettings.
-