Package com.github.stephengold.joltjni
Class PhysicsSettings
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.PhysicsSettings
- All Implemented Interfaces:
ConstJoltPhysicsObject,AutoCloseable,Comparable<ConstJoltPhysicsObject>
A component of a
PhysicsSystem, used to configure simulation
parameters.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatpadding around objects (in meters) -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanTest whether objects can fall asleep.floatReturn the Baumgarte stabilization factor, the fraction of position error that is corrected in each update.booleanTest whether physics simulation is deterministic.intReturn the number of solver position iterations per simulation step.intReturn the number of velocity iterations per simulation step.floatReturn the penetration slop.floatReturn the point-motion threshold, below which objects can fall asleep.Access the underlyingPhysicsSystem.floatAlter the time interval before an object can fall asleep.voidsetAllowSleeping(boolean allow) Alter whether objects can go to sleep.voidsetBaumgarte(float fraction) Alter the Baumgarte stabilization factor, the fraction of position error to correct in each update.voidsetDeterministicSimulation(boolean setting) Alter whether physics simulation is deterministic.voidsetNumPositionSteps(int numSteps) Alter the number of solver position iterations per simulation step.voidsetNumVelocitySteps(int numSteps) Alter the number of velocity steps.voidsetPenetrationSlop(float slop) Alter the penetration slop.voidsetPointVelocitySleepThreshold(float speed) Alter the point-motion threshold, below which an object can fall asleep.voidsetTimeBeforeSleep(float interval) Alter the time interval before an object can fall asleep.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, startCleaner, toString, va
-
Field Details
-
cDefaultConvexRadius
public static final float cDefaultConvexRadiuspadding around objects (in meters)- See Also:
-
-
Constructor Details
-
PhysicsSettings
public PhysicsSettings()Instantiate the default settings.
-
-
Method Details
-
getAllowSleeping
public boolean getAllowSleeping()Test whether objects can fall asleep. The settings are unaffected. (native attribute: mAllowSleeping)- Returns:
- true if sleeping is allowed, otherwise false
-
getBaumgarte
public float getBaumgarte()Return the Baumgarte stabilization factor, the fraction of position error that is corrected in each update. The settings are unaffected. (native attribute: mBaumgarte)- Returns:
- the factor (≥0, ≤1)
-
getDeterministicSimulation
public boolean getDeterministicSimulation()Test whether physics simulation is deterministic. The settings are unaffected. (native attribute: mDeterministicSimulation)- Returns:
- true if it is deterministic, otherwise false
-
getNumPositionSteps
public int getNumPositionSteps()Return the number of solver position iterations per simulation step. The settings are unaffected. (native attribute: mNumPositionSteps)- Returns:
- the number (≥0)
-
getNumVelocitySteps
public int getNumVelocitySteps()Return the number of velocity iterations per simulation step. The settings are unaffected. (native attribute: mNumVelocitySteps)- Returns:
- the number (≥0)
-
getPenetrationSlop
public float getPenetrationSlop()Return the penetration slop. The settings are unaffected. (native attribute: mPenetrationSlop)- Returns:
- the slop distance (in meters)
-
getSystem
Access the underlyingPhysicsSystem.- Returns:
- the pre-existing instance
-
getPointVelocitySleepThreshold
public float getPointVelocitySleepThreshold()Return the point-motion threshold, below which objects can fall asleep. The settings are unaffected. (native attribute: mPointVelocitySleepThreshold)- Returns:
- the speed threshold (in meters/second, ≥0)
-
getTimeBeforeSleep
public float getTimeBeforeSleep()Alter the time interval before an object can fall asleep. The settings are unaffected. (native attribute: mTimeBeforeSleep)- Returns:
- the interval (in seconds, ≥0)
-
setAllowSleeping
public void setAllowSleeping(boolean allow) Alter whether objects can go to sleep. (native attribute: mAllowSleeping)- Parameters:
allow- true to allow sleeping, false to disallow it (default=true)
-
setBaumgarte
public void setBaumgarte(float fraction) Alter the Baumgarte stabilization factor, the fraction of position error to correct in each update. (native attribute: mBaumgarte)- Parameters:
fraction- the desired factor (≥0, ≤1, default=0.2)
-
setDeterministicSimulation
public void setDeterministicSimulation(boolean setting) Alter whether physics simulation is deterministic. (native attribute: mDeterministicSimulation)- Parameters:
setting- true to be deterministic, false to relax this policy (default=true)
-
setNumPositionSteps
public void setNumPositionSteps(int numSteps) Alter the number of solver position iterations per simulation step. (native attribute: mNumPositionSteps)- Parameters:
numSteps- the desired number (≥0, default=2)
-
setNumVelocitySteps
public void setNumVelocitySteps(int numSteps) Alter the number of velocity steps. (native attribute: mNumVelocitySteps)- Parameters:
numSteps- the desired number (≥0, default=10)
-
setPenetrationSlop
public void setPenetrationSlop(float slop) Alter the penetration slop. (native attribute: mPenetrationSlop)- Parameters:
slop- the desired slop distance (in meters, default=0.02)
-
setPointVelocitySleepThreshold
public void setPointVelocitySleepThreshold(float speed) Alter the point-motion threshold, below which an object can fall asleep. (native attribute: mPointVelocitySleepThreshold)- Parameters:
speed- the desired speed threshold (in meters/second, ≥0, default=0.03)
-
setTimeBeforeSleep
public void setTimeBeforeSleep(float interval) Alter the time interval before an object can fall asleep. (native attribute: mTimeBeforeSleep)- Parameters:
interval- the desired time interval (in seconds, ≥0, default=0.5)
-