Jolt Physics
A multi core friendly Game Physics Engine
|
#include <PhysicsSettings.h>
Public Attributes | |
JPH_OVERRIDE_NEW_DELETE int | mMaxInFlightBodyPairs = 16384 |
int | mStepListenersBatchSize = 8 |
How many PhysicsStepListeners to notify in 1 batch. | |
int | mStepListenerBatchesPerJob = 1 |
How many step listener batches are needed before spawning another job (set to INT_MAX if no parallelism is desired) | |
float | mBaumgarte = 0.2f |
Baumgarte stabilization factor (how much of the position error to 'fix' in 1 update) (unit: dimensionless, 0 = nothing, 1 = 100%) | |
float | mSpeculativeContactDistance = 0.02f |
float | mPenetrationSlop = 0.02f |
How much bodies are allowed to sink into each other (unit: meters) | |
float | mLinearCastThreshold = 0.75f |
Fraction of its inner radius a body must move per step to enable casting for the LinearCast motion quality. | |
float | mLinearCastMaxPenetration = 0.25f |
Fraction of its inner radius a body may penetrate another body for the LinearCast motion quality. | |
float | mManifoldToleranceSq = 1.0e-6f |
Max squared distance to use to determine if two points are on the same plane for determining the contact manifold between two shape faces (unit: meter^2) | |
float | mMaxPenetrationDistance = 0.2f |
Maximum distance to correct in a single iteration when solving position constraints (unit: meters) | |
float | mBodyPairCacheMaxDeltaPositionSq = Square(0.001f) |
Maximum relative delta position for body pairs to be able to reuse collision results from last frame (units: meter^2) | |
float | mBodyPairCacheCosMaxDeltaRotationDiv2 = 0.99984769515639123915701155881391f |
Maximum relative delta orientation for body pairs to be able to reuse collision results from last frame, stored as cos(max angle / 2) | |
float | mContactNormalCosMaxDeltaRotation = 0.99619469809174553229501040247389f |
Maximum angle between normals that allows manifolds between different sub shapes of the same body pair to be combined. | |
float | mContactPointPreserveLambdaMaxDistSq = Square(0.01f) |
Maximum allowed distance between old and new contact point to preserve contact forces for warm start (units: meter^2) | |
uint | mNumVelocitySteps = 10 |
uint | mNumPositionSteps = 2 |
Number of solver position iterations to run. | |
float | mMinVelocityForRestitution = 1.0f |
float | mTimeBeforeSleep = 0.5f |
Time before object is allowed to go to sleep (unit: seconds) | |
float | mPointVelocitySleepThreshold = 0.03f |
bool | mDeterministicSimulation = true |
By default the simulation is deterministic, it is possible to turn this off by setting this setting to false. This will make the simulation run faster but it will no longer be deterministic. | |
These variables are mainly for debugging purposes, they allow turning on/off certain subsystems. You probably want to leave them alone. | |
bool | mConstraintWarmStart = true |
Whether or not to use warm starting for constraints (initially applying previous frames impulses) | |
bool | mUseBodyPairContactCache = true |
Whether or not to use the body pair cache, which removes the need for narrow phase collision detection when orientation between two bodies didn't change. | |
bool | mUseManifoldReduction = true |
Whether or not to reduce manifolds with similar contact normals into one contact manifold (see description at Body::SetUseManifoldReduction) | |
bool | mUseLargeIslandSplitter = true |
If we split up large islands into smaller parallel batches of work (to improve performance) | |
bool | mAllowSleeping = true |
If objects can go to sleep or not. | |
bool | mCheckActiveEdges = true |
When false, we prevent collision against non-active (shared) edges. Mainly for debugging the algorithm. | |
bool PhysicsSettings::mAllowSleeping = true |
If objects can go to sleep or not.
float PhysicsSettings::mBaumgarte = 0.2f |
Baumgarte stabilization factor (how much of the position error to 'fix' in 1 update) (unit: dimensionless, 0 = nothing, 1 = 100%)
float PhysicsSettings::mBodyPairCacheCosMaxDeltaRotationDiv2 = 0.99984769515639123915701155881391f |
Maximum relative delta orientation for body pairs to be able to reuse collision results from last frame, stored as cos(max angle / 2)
cos(2 degrees / 2)
float PhysicsSettings::mBodyPairCacheMaxDeltaPositionSq = Square(0.001f) |
Maximum relative delta position for body pairs to be able to reuse collision results from last frame (units: meter^2)
1 mm
bool PhysicsSettings::mCheckActiveEdges = true |
When false, we prevent collision against non-active (shared) edges. Mainly for debugging the algorithm.
bool PhysicsSettings::mConstraintWarmStart = true |
Whether or not to use warm starting for constraints (initially applying previous frames impulses)
float PhysicsSettings::mContactNormalCosMaxDeltaRotation = 0.99619469809174553229501040247389f |
Maximum angle between normals that allows manifolds between different sub shapes of the same body pair to be combined.
cos(5 degree)
float PhysicsSettings::mContactPointPreserveLambdaMaxDistSq = Square(0.01f) |
Maximum allowed distance between old and new contact point to preserve contact forces for warm start (units: meter^2)
1 cm
bool PhysicsSettings::mDeterministicSimulation = true |
By default the simulation is deterministic, it is possible to turn this off by setting this setting to false. This will make the simulation run faster but it will no longer be deterministic.
float PhysicsSettings::mLinearCastMaxPenetration = 0.25f |
Fraction of its inner radius a body may penetrate another body for the LinearCast motion quality.
float PhysicsSettings::mLinearCastThreshold = 0.75f |
Fraction of its inner radius a body must move per step to enable casting for the LinearCast motion quality.
float PhysicsSettings::mManifoldToleranceSq = 1.0e-6f |
Max squared distance to use to determine if two points are on the same plane for determining the contact manifold between two shape faces (unit: meter^2)
JPH_OVERRIDE_NEW_DELETE int PhysicsSettings::mMaxInFlightBodyPairs = 16384 |
Size of body pairs array, corresponds to the maximum amount of potential body pairs that can be in flight at any time. Setting this to a low value will use less memory but slow down simulation as threads may run out of narrow phase work.
float PhysicsSettings::mMaxPenetrationDistance = 0.2f |
Maximum distance to correct in a single iteration when solving position constraints (unit: meters)
float PhysicsSettings::mMinVelocityForRestitution = 1.0f |
Minimal velocity needed before a collision can be elastic. If the relative velocity between colliding objects in the direction of the contact normal is lower than this, the restitution will be zero regardless of the configured value. This lets an object settle sooner. Must be a positive number. (unit: m)
uint PhysicsSettings::mNumPositionSteps = 2 |
Number of solver position iterations to run.
uint PhysicsSettings::mNumVelocitySteps = 10 |
Number of solver velocity iterations to run Note that this needs to be >= 2 in order for friction to work (friction is applied using the non-penetration impulse from the previous iteration)
float PhysicsSettings::mPenetrationSlop = 0.02f |
How much bodies are allowed to sink into each other (unit: meters)
float PhysicsSettings::mPointVelocitySleepThreshold = 0.03f |
To detect if an object is sleeping, we use 3 points:
float PhysicsSettings::mSpeculativeContactDistance = 0.02f |
Radius around objects inside which speculative contact points will be detected. Note that if this is too big you will get ghost collisions as speculative contacts are based on the closest points during the collision detection step which may not be the actual closest points by the time the two objects hit (unit: meters)
int PhysicsSettings::mStepListenerBatchesPerJob = 1 |
How many step listener batches are needed before spawning another job (set to INT_MAX if no parallelism is desired)
int PhysicsSettings::mStepListenersBatchSize = 8 |
How many PhysicsStepListeners to notify in 1 batch.
float PhysicsSettings::mTimeBeforeSleep = 0.5f |
Time before object is allowed to go to sleep (unit: seconds)
bool PhysicsSettings::mUseBodyPairContactCache = true |
Whether or not to use the body pair cache, which removes the need for narrow phase collision detection when orientation between two bodies didn't change.
bool PhysicsSettings::mUseLargeIslandSplitter = true |
If we split up large islands into smaller parallel batches of work (to improve performance)
bool PhysicsSettings::mUseManifoldReduction = true |
Whether or not to reduce manifolds with similar contact normals into one contact manifold (see description at Body::SetUseManifoldReduction)