java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.PhysicsSettings
- All Implemented Interfaces:
ConstJoltPhysicsObject
,AutoCloseable
,Comparable<JoltPhysicsObject>
A component of a
PhysicsSystem
, used to configure simulation
parameters.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Test whether objects can fall asleep.float
Return the Baumgarte stabilization factor, the fraction of position error that is corrected in each update.boolean
Test whether physics simulation is deterministic.int
Return the number of solver position iterations per simulation step.int
Return the number of velocity iterations per simulation step.float
Return the penetration slop.float
Return the point-motion threshold, below which objects can fall asleep.float
Alter the time interval before an object can fall asleep.void
setAllowSleeping
(boolean allow) Alter whether objects can go to sleep.void
setBaumgarte
(float fraction) Alter the Baumgarte stabilization factor, the fraction of position error to correct in each update.void
setDeterministicSimulation
(boolean setting) Alter whether physics simulation is deterministic.void
setNumPositionSteps
(int numSteps) Alter the number of solver position iterations per simulation step.void
setNumVelocitySteps
(int numSteps) Alter the number of velocity steps.void
setPenetrationSlop
(float slop) Alter the penetration slop.void
setPointVelocitySleepThreshold
(float speed) Alter the point-motion threshold, below which an object can fall asleep.void
setTimeBeforeSleep
(float interval) Alter the time interval before an object can fall asleep.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
-
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, otherwisefalse
-
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, otherwisefalse
-
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)
-
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 per 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 per 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)
-