Step configuration. More...
#include <StepConf.hpp>
Public Types | |
| using | iteration_type = TimestepIters |
| Step iterations type. More... | |
Public Member Functions | |
| Time | GetTime () const noexcept |
| Gets the delta time (time amount for this time step). More... | |
| Frequency | GetInvTime () const noexcept |
| Gets the inverse delta-t value. More... | |
| PLAYRHO_CONSTEXPR StepConf & | SetTime (Time value) noexcept |
| Sets the delta time and inverse time from the given value and its inverse respectively. More... | |
| PLAYRHO_CONSTEXPR StepConf & | SetInvTime (Frequency value) noexcept |
| Sets the inverse time and delta time from the given value and its inverse respectively. More... | |
Static Public Attributes | |
| static const PLAYRHO_CONSTEXPR auto | InvalidIteration = static_cast<iteration_type>(-1) |
| Invalid iteration value. More... | |
Related Functions | |
(Note that these are not member functions.) | |
| MovementConf | GetMovementConf (const StepConf &conf) noexcept |
| Gets the movement configuration from the given value. More... | |
| Length | GetMaxRegLinearCorrection (const StepConf &conf) noexcept |
| Gets the maximum regular linear correction from the given value. More... | |
| bool | IsMaxTranslationWithinTolerance (const StepConf &conf) noexcept |
| Determines whether the maximum translation is within tolerance. More... | |
Detailed Description
Step configuration.
Provides the primary means for configuring the per-step world physics simulation. All the values have defaults. These defaults are intended to most likely be the values desired.
- Note
- Be sure to confirm that the delta time (the time-per-step i.e.
dt) is correct for your use. - This data structure is 108-bytes large (with 4-byte Real on at least one 64-bit platform).
- See also
- World::Step.
- Examples
- Body.cpp, HelloWorld.cpp, and World.cpp.
Definition at line 41 of file StepConf.hpp.
Member Typedef Documentation
◆ iteration_type
Step iterations type.
A type for counting iterations per-step.
- Note
- The special value of -1 is reserved for signifying an invalid iteration value.
Definition at line 47 of file StepConf.hpp.
Member Function Documentation
◆ GetTime()
|
inlinenoexcept |
Gets the delta time (time amount for this time step).
- See also
- SetTime(Real).
- Returns
- Time step amount in seconds.
Definition at line 55 of file StepConf.hpp.
◆ GetInvTime()
|
inlinenoexcept |
Gets the inverse delta-t value.
- Returns
1/dtor 0 ifdtis 0.
- See also
- GetTime().
Definition at line 60 of file StepConf.hpp.
◆ SetTime()
|
inlinenoexcept |
Sets the delta time and inverse time from the given value and its inverse respectively.
- Note
- Used in both the regular and TOI phases of step processing.
- Postcondition
- Getting the delta time will return this value.
- The inverse delta time value is the inverse of the given value or zero if the value is zero.
- See also
- GetTime().
- GetInvTime().
- Parameters
-
value Elapsed time amount.
- Examples
- World.cpp.
Definition at line 69 of file StepConf.hpp.
◆ SetInvTime()
|
inlinenoexcept |
Sets the inverse time and delta time from the given value and its inverse respectively.
- Note
- Used in both the regular and TOI phases of step processing.
- Postcondition
- Getting the inverse delta time will return this value.
- The delta time value is the inverse of the given value or zero if the value is zero.
- See also
- GetTime().
- GetInvTime().
- Parameters
-
value Inverse time amount.
- Examples
- World.cpp.
Definition at line 83 of file StepConf.hpp.
Friends And Related Function Documentation
◆ GetMovementConf()
|
related |
Gets the movement configuration from the given value.
- Returns
- The
maxTranslationandmaxRotationfields of the given value respectively are returned.
Definition at line 26 of file MovementConf.cpp.
◆ GetMaxRegLinearCorrection()
Gets the maximum regular linear correction from the given value.
Definition at line 331 of file StepConf.hpp.
◆ IsMaxTranslationWithinTolerance()
|
related |
Determines whether the maximum translation is within tolerance.
Definition at line 27 of file StepConf.cpp.
Member Data Documentation
◆ InvalidIteration
|
static |
Invalid iteration value.
Definition at line 50 of file StepConf.hpp.
◆ dtRatio
| Real playrho::StepConf::dtRatio = 1 |
Delta time ratio.
This is the delta-time multiplied by the inverse delta time from the previous world step. The value of 1 indicates that the time step has not varied.
- Note
- Used in the regular phase processing of the step.
- Examples
- World.cpp.
Definition at line 94 of file StepConf.hpp.
◆ minStillTimeToSleep
| Time playrho::StepConf::minStillTimeToSleep = DefaultMinStillTimeToSleep |
Minimum still time to sleep.
The time that a body must be still before it will be put to sleep.
- Note
- Set to infinity to disable sleeping.
- Used in the regular phase processing of the step.
Definition at line 100 of file StepConf.hpp.
◆ linearSlop
| Positive<Length> playrho::StepConf::linearSlop = DefaultLinearSlop |
Linear slop.
Linear slop for position resolution.
- Note
- Must be greater than 0.
- Used in both the regular and TOI phases of step processing.
- Examples
- World.cpp.
Definition at line 106 of file StepConf.hpp.
◆ angularSlop
| Positive<Angle> playrho::StepConf::angularSlop = DefaultAngularSlop |
Angular slop.
- Note
- Must be greater than 0.
- Used in both the regular and TOI phases of step processing.
Definition at line 111 of file StepConf.hpp.
◆ regResolutionRate
Regular resolution rate.
This scale factor controls how fast positional overlap is resolved. Ideally this would be 1 so that overlap is removed in one time step. However using values close to 1 often lead to overshoot.
- Note
- Must be greater than 0 for any regular-phase positional resolution to get done.
- Used in the regular phase of step processing.
Definition at line 120 of file StepConf.hpp.
◆ regMinSeparation
| Length playrho::StepConf::regMinSeparation = -DefaultLinearSlop * Real{3} |
Regular minimum separation.
This is the minimum amount of separation there must be between regular-phase interacting bodies for intra-step position resolution to be considered successful and end before all of the regular position iterations have been done.
- Note
- Used in the regular phase of step processing.
- See also
- regPositionIterations.
- Examples
- World.cpp.
Definition at line 129 of file StepConf.hpp.
◆ regMinMomentum
| Momentum playrho::StepConf::regMinMomentum = DefaultRegMinMomentum |
Regular-phase min momentum.
Definition at line 132 of file StepConf.hpp.
◆ toiResolutionRate
Time of impact resolution rate.
This scale factor controls how fast positional overlap is resolved. Ideally this would be 1 so that overlap is removed in one time step. However using values close to 1 often lead to overshoot.
- Note
- Used in the TOI phase of step processing.
- Must be greater than 0 for any TOI-phase positional resolution to get done.
Definition at line 141 of file StepConf.hpp.
◆ toiMinSeparation
| Length playrho::StepConf::toiMinSeparation = -DefaultLinearSlop * Real(1.5f) |
Time of impact minimum separation.
This is the minimum amount of separation there must be between TOI-phase interacting bodies for intra-step position resolution to be considered successful and end before all of the TOI position iterations have been done.
- Note
- Used in the TOI phase of step processing.
- See also
- toiPositionIterations.
- Examples
- World.cpp.
Definition at line 150 of file StepConf.hpp.
◆ toiMinMomentum
| Momentum playrho::StepConf::toiMinMomentum = DefaultToiMinMomentum |
TOI-phase min momentum.
Definition at line 153 of file StepConf.hpp.
◆ targetDepth
| Length playrho::StepConf::targetDepth = DefaultLinearSlop * Real{3} |
Target depth.
Target depth of overlap for calculating the TOI for CCD eligible bodies.
- Note
- Recommend value that's less than twice the world's minimum vertex radius.
- Used in the TOI phase of step processing.
- Examples
- World.cpp.
Definition at line 159 of file StepConf.hpp.
◆ tolerance
| NonNegative<Length> playrho::StepConf::tolerance = DefaultLinearSlop / Real{4} |
Tolerance.
The acceptable plus or minus tolerance from the target depth for TOI calculations.
- Note
- Must be greater than 0.
- Must not be subnormal.
- Must be less than the target depth.
- Used in the TOI phase of step processing.
- Examples
- World.cpp.
Definition at line 167 of file StepConf.hpp.
◆ velocityThreshold
| LinearVelocity playrho::StepConf::velocityThreshold = DefaultVelocityThreshold |
Velocity threshold.
A velocity threshold for elastic collisions. Any collision with a relative linear velocity below this threshold will be treated as inelastic.
- Note
- Used in both the regular and TOI phases of step processing.
- Examples
- World.cpp.
Definition at line 173 of file StepConf.hpp.
◆ maxTranslation
| Length playrho::StepConf::maxTranslation = DefaultMaxTranslation |
Maximum translation.
The maximum amount a body can translate in a single step. This represents an upper bound on the maximum linear velocity of a body of max-translation per time.
- Note
- If you want or need to support a higher maximum linear speed, then instead of changing this value, decrease the step's time value. So for example, rather than simulating 1/60th of a second steps, simulating 1/120th of a second steps will double the maximum linear speed any body can have.
- This limit is meant to prevent numerical problems. Adjusting this value isn't advised.
- Used in both the regular and TOI phases of step processing.
- Examples
- World.cpp.
Definition at line 188 of file StepConf.hpp.
◆ maxRotation
| Angle playrho::StepConf::maxRotation = DefaultMaxRotation |
Maximum rotation.
The maximum amount a body can rotate in a single step. This represents an upper bound on the maximum angular speed of a body of max rotation / time.
- Warning
- This value should be less than Pi * Radian.
- Note
- If you want or need to support a higher maximum angular speed, then instead of changing this value, decrease the step's time value. So for example, rather than simulating 1/60th of a second steps, simulating 1/120th of a second steps will double the maximum angular rotation any body can have.
- This limit is meant to prevent numerical problems. Adjusting this value isn't advised.
- If this value is less than half a turn (less than Pi), then the turning direction will be the direction of the smaller change in angular orientation. This is an appealing property as it means that a body's angular position can be represented by a unit vector rather than an angular quantity. The benefit of using a unit vector is potentially two-fold: (a) unit vectors have well-defined and understood wrap-around semantics, (b) unit vectors can cache sine/cosine calculations thereby reducing their costs in time.
- Used in both the regular and TOI phases of step processing.
Definition at line 212 of file StepConf.hpp.
◆ maxLinearCorrection
| Length playrho::StepConf::maxLinearCorrection = DefaultMaxLinearCorrection |
Maximum linear correction.
- Note
- Must be greater than 0 for any positional resolution to get done.
- This value should be greater than the linear slop value.
- Used in both the regular and TOI phases of step processing.
- Examples
- World.cpp.
Definition at line 218 of file StepConf.hpp.
◆ maxAngularCorrection
| Angle playrho::StepConf::maxAngularCorrection = DefaultMaxAngularCorrection |
Maximum angular correction.
- Note
- Used in both the regular and TOI phases of step processing.
- Examples
- World.cpp.
Definition at line 222 of file StepConf.hpp.
◆ linearSleepTolerance
| LinearVelocity playrho::StepConf::linearSleepTolerance = DefaultLinearSleepTolerance |
Linear sleep tolerance.
- Note
- Used in the regular phase of step processing.
Definition at line 226 of file StepConf.hpp.
◆ angularSleepTolerance
| AngularVelocity playrho::StepConf::angularSleepTolerance = DefaultAngularSleepTolerance |
Angular sleep tolerance.
- Note
- Used in the regular phase of step processing.
Definition at line 230 of file StepConf.hpp.
◆ displaceMultiplier
| Real playrho::StepConf::displaceMultiplier = DefaultDistanceMultiplier |
Displacement multiplier for directional AABB fattening.
Definition at line 233 of file StepConf.hpp.
◆ aabbExtension
| Length playrho::StepConf::aabbExtension = DefaultAabbExtension |
AABB extension.
This is the extension that will be applied to Axis Aligned Bounding Box objects used in broad phase collision detection. This fattens AABBs in the dynamic tree. This allows proxies to move by a small amount without triggering a tree adjustment.
- Note
- Should be greater than 0.
- Examples
- World.cpp.
Definition at line 241 of file StepConf.hpp.
◆ maxCirclesRatio
| Real playrho::StepConf::maxCirclesRatio = DefaultCirclesRatio |
Max. circles ratio.
When the ratio of the closest face's length to the vertex radius is more than this amount, then face-manifolds are forced, else circles-manifolds may be computed for new contact manifolds.
- Note
- This is used in the calculation of new contact manifolds.
Definition at line 248 of file StepConf.hpp.
◆ regVelocityIterations
| iteration_type playrho::StepConf::regVelocityIterations = 8 |
Regular velocity iterations.
The number of iterations of velocity resolution that will be done in the step.
- Note
- Used in the regular phase of step processing.
Definition at line 253 of file StepConf.hpp.
◆ regPositionIterations
| iteration_type playrho::StepConf::regPositionIterations = 3 |
Regular position iterations.
This is the maximum number of iterations of position resolution that will be done before leaving any remaining unsatisfied positions for the next step. In this context, positions are satisfied when the minimum separation is greater than or equal to the regular minimum separation amount.
- Note
- Used in the regular phase of step processing.
- See also
- regMinSeparation.
- Examples
- World.cpp.
Definition at line 263 of file StepConf.hpp.
◆ toiVelocityIterations
| iteration_type playrho::StepConf::toiVelocityIterations = 8 |
TOI velocity iterations.
This is the number of iterations of velocity resolution that will be done in the step.
- Note
- Used in the TOI phase of step processing.
Definition at line 269 of file StepConf.hpp.
◆ toiPositionIterations
| iteration_type playrho::StepConf::toiPositionIterations = 20 |
TOI position iterations.
This value is the maximum number of iterations of position resolution that will be done before leaving any remaining unsatisfied positions for the next step. In this context, positions are satisfied when the minimum separation is greater than or equal to the TOI minimum separation amount.
- Note
- Used in the TOI phase of step processing.
- See also
- toiMinSeparation.
Definition at line 279 of file StepConf.hpp.
◆ maxToiRootIters
| iteration_type playrho::StepConf::maxToiRootIters = DefaultMaxToiRootIters |
Max TOI root finder iterations.
- Note
- Used in the TOI phase of step processing.
Definition at line 283 of file StepConf.hpp.
◆ maxToiIters
| iteration_type playrho::StepConf::maxToiIters = DefaultMaxToiIters |
Max TOI iterations.
- Note
- Used in the TOI phase of step processing.
Definition at line 287 of file StepConf.hpp.
◆ maxDistanceIters
| iteration_type playrho::StepConf::maxDistanceIters = DefaultMaxDistanceIters |
Max distance iterations.
- Note
- Used in the TOI phase of step processing.
Definition at line 291 of file StepConf.hpp.
◆ maxSubSteps
| iteration_type playrho::StepConf::maxSubSteps = DefaultMaxSubSteps |
Maximum sub steps.
This is the maximum number of sub-steps per contact in continuous physics simulation. In other words, this is the maximum number of times in a world step that a contact will have continuous collision resolution done for it.
- Note
- Used in the TOI phase of step processing.
- Examples
- World.cpp.
Definition at line 299 of file StepConf.hpp.
◆ doWarmStart
| bool playrho::StepConf::doWarmStart = true |
Do warm start.
Whether or not to perform warm starting (in the regular phase).
- Note
- Used in the regular phase of step processing.
Definition at line 304 of file StepConf.hpp.
◆ doToi
| bool playrho::StepConf::doToi = true |
Do time of impact (TOI) calculations.
Whether or not to perform any time of impact (TOI) calculations used for doing continuous collision detection. Without this, steps can potentially be computed faster but with increased chance of bodies passing unobstructed through other bodies (a process called "tunneling") even when they're not supposed to be able to go through them.
- Note
- Used in the TOI phase of step processing.
Definition at line 313 of file StepConf.hpp.
◆ doBlocksolve
| bool playrho::StepConf::doBlocksolve = true |
Do the block-solve algorithm.
Definition at line 316 of file StepConf.hpp.
The documentation for this class was generated from the following files:
- Dynamics/StepConf.hpp
- Dynamics/MovementConf.hpp

