Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
PhysicsSettings Struct Reference

#include <PhysicsSettings.h>

Public Attributes

JPH_OVERRIDE_NEW_DELETE int mMaxInFlightBodyPairs = 16384
 
int mStepListenersBatchSize = 8
 How many PhysicsStepListeners to notify in 1 batch. More...
 
int mStepListenerBatchesPerJob = 1
 How many step listener batches are needed before spawning another job (set to INT_MAX if no parallelism is desired) More...
 
float mBaumgarte = 0.2f
 Baumgarte stabilization factor (how much of the position error to 'fix' in 1 update) (unit: dimensionless, 0 = nothing, 1 = 100%) More...
 
float mSpeculativeContactDistance = 0.02f
 
float mPenetrationSlop = 0.02f
 How much bodies are allowed to sink into each other (unit: meters) More...
 
float mLinearCastThreshold = 0.75f
 Fraction of its inner radius a body must move per step to enable casting for the LinearCast motion quality. More...
 
float mLinearCastMaxPenetration = 0.25f
 Fraction of its inner radius a body may penetrate another body for the LinearCast motion quality. More...
 
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) More...
 
float mMaxPenetrationDistance = 0.2f
 Maximum distance to correct in a single iteration when solving position constraints (unit: meters) More...
 
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) More...
 
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) More...
 
float mContactNormalCosMaxDeltaRotation = 0.99619469809174553229501040247389f
 Maximum angle between normals that allows manifolds between different sub shapes of the same body pair to be combined. More...
 
float mContactPointPreserveLambdaMaxDistSq = Square(0.01f)
 Maximum allowed distance between old and new contact point to preserve contact forces for warm start (units: meter^2) More...
 
uint mNumVelocitySteps = 10
 
uint mNumPositionSteps = 2
 Number of solver position iterations to run. More...
 
float mMinVelocityForRestitution = 1.0f
 Minimal velocity needed before a collision can be elastic (unit: m) More...
 
float mTimeBeforeSleep = 0.5f
 Time before object is allowed to go to sleep (unit: seconds) More...
 
float mPointVelocitySleepThreshold = 0.03f
 Velocity of points on bounding box of object below which an object can be considered sleeping (unit: m/s) More...
 
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. More...
 
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) More...
 
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. More...
 
bool mUseManifoldReduction = true
 Whether or not to reduce manifolds with similar contact normals into one contact manifold (see description at Body::SetUseManifoldReduction) More...
 
bool mUseLargeIslandSplitter = true
 If we split up large islands into smaller parallel batches of work (to improve performance) More...
 
bool mAllowSleeping = true
 If objects can go to sleep or not. More...
 
bool mCheckActiveEdges = true
 When false, we prevent collision against non-active (shared) edges. Mainly for debugging the algorithm. More...
 

Member Data Documentation

◆ mAllowSleeping

bool PhysicsSettings::mAllowSleeping = true

If objects can go to sleep or not.

◆ mBaumgarte

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%)

◆ mBodyPairCacheCosMaxDeltaRotationDiv2

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)

◆ mBodyPairCacheMaxDeltaPositionSq

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

◆ mCheckActiveEdges

bool PhysicsSettings::mCheckActiveEdges = true

When false, we prevent collision against non-active (shared) edges. Mainly for debugging the algorithm.

◆ mConstraintWarmStart

bool PhysicsSettings::mConstraintWarmStart = true

Whether or not to use warm starting for constraints (initially applying previous frames impulses)

◆ mContactNormalCosMaxDeltaRotation

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)

◆ mContactPointPreserveLambdaMaxDistSq

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

◆ mDeterministicSimulation

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.

◆ mLinearCastMaxPenetration

float PhysicsSettings::mLinearCastMaxPenetration = 0.25f

Fraction of its inner radius a body may penetrate another body for the LinearCast motion quality.

◆ mLinearCastThreshold

float PhysicsSettings::mLinearCastThreshold = 0.75f

Fraction of its inner radius a body must move per step to enable casting for the LinearCast motion quality.

◆ mManifoldToleranceSq

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)

◆ mMaxInFlightBodyPairs

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.

◆ mMaxPenetrationDistance

float PhysicsSettings::mMaxPenetrationDistance = 0.2f

Maximum distance to correct in a single iteration when solving position constraints (unit: meters)

◆ mMinVelocityForRestitution

float PhysicsSettings::mMinVelocityForRestitution = 1.0f

Minimal velocity needed before a collision can be elastic (unit: m)

◆ mNumPositionSteps

uint PhysicsSettings::mNumPositionSteps = 2

Number of solver position iterations to run.

◆ mNumVelocitySteps

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)

◆ mPenetrationSlop

float PhysicsSettings::mPenetrationSlop = 0.02f

How much bodies are allowed to sink into each other (unit: meters)

◆ mPointVelocitySleepThreshold

float PhysicsSettings::mPointVelocitySleepThreshold = 0.03f

Velocity of points on bounding box of object below which an object can be considered sleeping (unit: m/s)

◆ mSpeculativeContactDistance

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)

◆ mStepListenerBatchesPerJob

int PhysicsSettings::mStepListenerBatchesPerJob = 1

How many step listener batches are needed before spawning another job (set to INT_MAX if no parallelism is desired)

◆ mStepListenersBatchSize

int PhysicsSettings::mStepListenersBatchSize = 8

How many PhysicsStepListeners to notify in 1 batch.

◆ mTimeBeforeSleep

float PhysicsSettings::mTimeBeforeSleep = 0.5f

Time before object is allowed to go to sleep (unit: seconds)

◆ mUseBodyPairContactCache

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.

◆ mUseLargeIslandSplitter

bool PhysicsSettings::mUseLargeIslandSplitter = true

If we split up large islands into smaller parallel batches of work (to improve performance)

◆ mUseManifoldReduction

bool PhysicsSettings::mUseManifoldReduction = true

Whether or not to reduce manifolds with similar contact normals into one contact manifold (see description at Body::SetUseManifoldReduction)


The documentation for this struct was generated from the following file: