Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
PhysicsSettings.h
Go to the documentation of this file.
1// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
2// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
8
10constexpr float cDefaultCollisionTolerance = 1.0e-4f;
11
13constexpr float cDefaultPenetrationTolerance = 1.0e-4f;
14
16constexpr float cDefaultConvexRadius = 0.05f;
17
19static constexpr float cCapsuleProjectionSlop = 0.02f;
20
22constexpr int cMaxPhysicsJobs = 2048;
23
25constexpr int cMaxPhysicsBarriers = 8;
26
28{
30
34
37
40
42 float mBaumgarte = 0.2f;
43
48
50 float mPenetrationSlop = 0.02f;
51
53 float mLinearCastThreshold = 0.75f;
54
57
59 float mManifoldToleranceSq = 1.0e-6f;
60
63
66
68 float mBodyPairCacheCosMaxDeltaRotationDiv2 = 0.99984769515639123915701155881391f;
69
71 float mContactNormalCosMaxDeltaRotation = 0.99619469809174553229501040247389f;
72
75
79
82
85
87 float mTimeBeforeSleep = 0.5f;
88
91
94
97
100
103
106
109
111 bool mAllowSleeping = true;
112
114 bool mCheckActiveEdges = true;
115
117};
118
unsigned int uint
Definition Core.h:453
#define JPH_NAMESPACE_END
Definition Core.h:379
#define JPH_NAMESPACE_BEGIN
Definition Core.h:373
JPH_INLINE constexpr T Square(T inV)
Square a value.
Definition Math.h:52
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition Memory.h:31
constexpr int cMaxPhysicsJobs
Maximum amount of jobs to allow.
Definition PhysicsSettings.h:22
JPH_NAMESPACE_BEGIN constexpr float cDefaultCollisionTolerance
If objects are closer than this distance, they are considered to be colliding (used for GJK) (unit: m...
Definition PhysicsSettings.h:10
constexpr int cMaxPhysicsBarriers
Maximum amount of barriers to allow.
Definition PhysicsSettings.h:25
constexpr float cDefaultPenetrationTolerance
A factor that determines the accuracy of the penetration depth calculation. If the change of the squa...
Definition PhysicsSettings.h:13
constexpr float cDefaultConvexRadius
How much padding to add around objects.
Definition PhysicsSettings.h:16
Definition PhysicsSettings.h:28
float mTimeBeforeSleep
Time before object is allowed to go to sleep (unit: seconds)
Definition PhysicsSettings.h:87
uint mNumPositionSteps
Number of solver position iterations to run.
Definition PhysicsSettings.h:81
float mMinVelocityForRestitution
Minimal velocity needed before a collision can be elastic (unit: m)
Definition PhysicsSettings.h:84
JPH_OVERRIDE_NEW_DELETE int mMaxInFlightBodyPairs
Definition PhysicsSettings.h:33
bool mAllowSleeping
If objects can go to sleep or not.
Definition PhysicsSettings.h:111
bool mUseBodyPairContactCache
Whether or not to use the body pair cache, which removes the need for narrow phase collision detectio...
Definition PhysicsSettings.h:102
int mStepListenersBatchSize
How many PhysicsStepListeners to notify in 1 batch.
Definition PhysicsSettings.h:36
uint mNumVelocitySteps
Definition PhysicsSettings.h:78
float mContactPointPreserveLambdaMaxDistSq
Maximum allowed distance between old and new contact point to preserve contact forces for warm start ...
Definition PhysicsSettings.h:74
float mBodyPairCacheMaxDeltaPositionSq
Maximum relative delta position for body pairs to be able to reuse collision results from last frame ...
Definition PhysicsSettings.h:65
float mMaxPenetrationDistance
Maximum distance to correct in a single iteration when solving position constraints (unit: meters)
Definition PhysicsSettings.h:62
float mPenetrationSlop
How much bodies are allowed to sink into each other (unit: meters)
Definition PhysicsSettings.h:50
float mSpeculativeContactDistance
Definition PhysicsSettings.h:47
float mLinearCastMaxPenetration
Fraction of its inner radius a body may penetrate another body for the LinearCast motion quality.
Definition PhysicsSettings.h:56
float mPointVelocitySleepThreshold
Velocity of points on bounding box of object below which an object can be considered sleeping (unit: ...
Definition PhysicsSettings.h:90
float mLinearCastThreshold
Fraction of its inner radius a body must move per step to enable casting for the LinearCast motion qu...
Definition PhysicsSettings.h:53
float mBodyPairCacheCosMaxDeltaRotationDiv2
Maximum relative delta orientation for body pairs to be able to reuse collision results from last fra...
Definition PhysicsSettings.h:68
bool mUseLargeIslandSplitter
If we split up large islands into smaller parallel batches of work (to improve performance)
Definition PhysicsSettings.h:108
bool mConstraintWarmStart
Whether or not to use warm starting for constraints (initially applying previous frames impulses)
Definition PhysicsSettings.h:99
bool mCheckActiveEdges
When false, we prevent collision against non-active (shared) edges. Mainly for debugging the algorith...
Definition PhysicsSettings.h:114
float mManifoldToleranceSq
Max squared distance to use to determine if two points are on the same plane for determining the cont...
Definition PhysicsSettings.h:59
float mBaumgarte
Baumgarte stabilization factor (how much of the position error to 'fix' in 1 update) (unit: dimension...
Definition PhysicsSettings.h:42
bool mDeterministicSimulation
By default the simulation is deterministic, it is possible to turn this off by setting this setting t...
Definition PhysicsSettings.h:93
float mContactNormalCosMaxDeltaRotation
Maximum angle between normals that allows manifolds between different sub shapes of the same body pai...
Definition PhysicsSettings.h:71
bool mUseManifoldReduction
Whether or not to reduce manifolds with similar contact normals into one contact manifold (see descri...
Definition PhysicsSettings.h:105
int mStepListenerBatchesPerJob
How many step listener batches are needed before spawning another job (set to INT_MAX if no paralleli...
Definition PhysicsSettings.h:39