PlayRho  2.0.0
An interactive physics engine & library.
playrho::StepConf Struct Reference

Step configuration. More...

#include <playrho/StepConf.hpp>

Collaboration diagram for playrho::StepConf:
[legend]

Public Types

using iteration_type = TimestepIters
 Step iterations type. More...
 

Public Attributes

Length aabbExtension = DefaultAabbExtension
 AABB extension. More...
 
AngularVelocity angularSleepTolerance = DefaultAngularSleepTolerance
 Angular sleep tolerance. More...
 
Positive< AngleangularSlop = DefaultAngularSlop
 Angular slop. More...
 
Time deltaTime = DefaultStepTime
 Delta time. More...
 
Real displaceMultiplier = DefaultDistanceMultiplier
 Displacement multiplier for directional AABB fattening.
 
bool doBlocksolve = DefaultDoBlocksolve
 Do the block-solve algorithm.
 
bool doToi = DefaultDoToi
 Do time of impact (TOI) calculations. More...
 
bool doWarmStart = DefaultDoWarmStart
 Do warm start. More...
 
Real dtRatio = DefaultDtRatio
 Delta time ratio. More...
 
LinearVelocity linearSleepTolerance = DefaultLinearSleepTolerance
 Linear sleep tolerance. More...
 
Positive< LengthlinearSlop = DefaultLinearSlop
 Linear slop. More...
 
Angle maxAngularCorrection = DefaultMaxAngularCorrection
 Maximum angular correction. More...
 
Real maxCirclesRatio = DefaultCirclesRatio
 Max. circles ratio. More...
 
iteration_type maxDistanceIters = DefaultMaxDistanceIters
 Max distance iterations. More...
 
Length maxLinearCorrection = DefaultMaxLinearCorrection
 Maximum linear correction. More...
 
Angle maxRotation = DefaultMaxRotation
 Maximum rotation. More...
 
iteration_type maxSubSteps = DefaultMaxSubSteps
 Maximum sub steps. More...
 
iteration_type maxToiIters = DefaultMaxToiIters
 Max TOI iterations. More...
 
iteration_type maxToiRootIters = DefaultMaxToiRootIters
 Max TOI root finder iterations. More...
 
Length maxTranslation = DefaultMaxTranslation
 Maximum translation. More...
 
Time minStillTimeToSleep = DefaultMinStillTimeToSleep
 Minimum still time to sleep. More...
 
Momentum regMinMomentum = DefaultRegMinMomentum
 Regular-phase minimum momentum.
 
Length regMinSeparation = DefaultRegMinSeparation
 Regular minimum separation. More...
 
iteration_type regPositionIters = DefaultRegPositionIters
 Regular position iterations. More...
 
Real regResolutionRate = DefaultRegResolutionRate
 Regular resolution rate. More...
 
iteration_type regVelocityIters = DefaultRegVelocityIters
 Regular velocity iterations. More...
 
NonNegative< LengthtargetDepth = DefaultTargetDepth
 Target depth. More...
 
Momentum toiMinMomentum = DefaultToiMinMomentum
 TOI-phase minimum momentum.
 
Length toiMinSeparation = DefaultToiMinSeparation
 Time of impact minimum separation. More...
 
iteration_type toiPositionIters = DefaultToiPositionIters
 TOI position iterations. More...
 
Real toiResolutionRate = DefaultToiResolutionRate
 Time of impact resolution rate. More...
 
iteration_type toiVelocityIters = DefaultToiVelocityIters
 TOI velocity iterations. More...
 
NonNegative< Lengthtolerance = DefaultTolerance
 Tolerance. More...
 
LinearVelocity velocityThreshold = DefaultVelocityThreshold
 Velocity threshold. More...
 

Static Public Attributes

static constexpr auto DefaultAabbExtension = Length{playrho::DefaultAabbExtension}
 Default abstract aligned bounding box (AABB) extension.
 
static constexpr auto DefaultAngularSleepTolerance = AngularVelocity{playrho::DefaultAngularSleepTolerance}
 Default angular sleep tolerance.
 
static constexpr auto DefaultAngularSlop = Positive<Angle>{playrho::DefaultAngularSlop}
 Default angular slop.
 
static constexpr auto DefaultCirclesRatio = Real(playrho::DefaultCirclesRatio)
 Default curcles ratio.
 
static constexpr auto DefaultDistanceMultiplier = Real(playrho::DefaultDistanceMultiplier)
 Default distance multiplier.
 
static constexpr auto DefaultDoBlocksolve = true
 Default do block-solve processing value .
 
static constexpr auto DefaultDoToi = true
 Default do time of impact (TOI) processing.
 
static constexpr auto DefaultDoWarmStart = true
 Default do warm start processing.
 
static constexpr auto DefaultDtRatio = Real(1)
 Default delta time ratio.
 
static constexpr auto DefaultLinearSleepTolerance = LinearVelocity{playrho::DefaultLinearSleepTolerance}
 Default linear sleep tolerance.
 
static constexpr auto DefaultLinearSlop = Positive<Length>{playrho::DefaultLinearSlop}
 Default linear slop. More...
 
static constexpr auto DefaultMaxAngularCorrection = Angle{playrho::DefaultMaxAngularCorrection}
 Default max angular correction.
 
static constexpr auto DefaultMaxDistanceIters = iteration_type{playrho::DefaultMaxDistanceIters}
 Default max distance iterations.
 
static constexpr auto DefaultMaxLinearCorrection = Length{playrho::DefaultMaxLinearCorrection}
 Default max linear correction.
 
static constexpr auto DefaultMaxRotation = Angle{playrho::DefaultMaxRotation}
 Default max rotation.
 
static constexpr auto DefaultMaxSubSteps = iteration_type{playrho::DefaultMaxSubSteps}
 Default max sub-steps value.
 
static constexpr auto DefaultMaxToiIters = iteration_type{playrho::DefaultMaxToiIters}
 Default max time of impact iterations.
 
static constexpr auto DefaultMaxToiRootIters = iteration_type{playrho::DefaultMaxToiRootIters}
 Default max time of impact root iterations.
 
static constexpr auto DefaultMaxTranslation = Length{playrho::DefaultMaxTranslation}
 Default max translation.
 
static constexpr auto DefaultMinStillTimeToSleep = Time{playrho::DefaultMinStillTimeToSleep}
 Default min still time to sleep.
 
static constexpr auto DefaultRegMinMomentum = Momentum{playrho::DefaultRegMinMomentum}
 Default regular min momentum.
 
static constexpr auto DefaultRegMinSeparation = -playrho::DefaultLinearSlop * Real(3)
 Default regular min separation.
 
static constexpr auto DefaultRegPositionIters = iteration_type{3}
 Default regular position iterations.
 
static constexpr auto DefaultRegResolutionRate = Real(2) / 10
 Default regular resolution rate.
 
static constexpr auto DefaultRegVelocityIters = iteration_type{8}
 Default regular velocity iterations.
 
static constexpr auto DefaultStepTime = Time{playrho::DefaultStepTime}
 Default step time.
 
static constexpr auto DefaultTargetDepth = NonNegative<Length>{DefaultLinearSlop * Real(3)}
 Default target depth. More...
 
static constexpr auto DefaultToiMinMomentum = Momentum{playrho::DefaultToiMinMomentum}
 Default time of impact (TOI) min momemtum.
 
static constexpr auto DefaultToiMinSeparation = -playrho::DefaultLinearSlop * Real(1.5f)
 Default time of impact (TOI) min separation.
 
static constexpr auto DefaultToiPositionIters = iteration_type{20}
 Default time of impact position iterations.
 
static constexpr auto DefaultToiResolutionRate = Real(75) / 100
 Default time of impact (TOI) resolution rate.
 
static constexpr auto DefaultToiVelocityIters = iteration_type{8}
 Default time of impact velocity iterations.
 
static constexpr auto DefaultTolerance = NonNegative<Length>{DefaultLinearSlop / Real(4)}
 Default tolerance. More...
 
static constexpr auto DefaultVelocityThreshold = LinearVelocity{playrho::DefaultVelocityThreshold}
 Default velocity threshold.
 
static constexpr auto InvalidIteration = static_cast<iteration_type>(-1)
 Invalid iteration value.
 

Related Functions

(Note that these are not member functions.)

Length GetMaxRegLinearCorrection (const StepConf &conf) noexcept
 Gets the maximum regular linear correction from the given value.
 
MovementConf GetMovementConf (const StepConf &conf) noexcept
 Gets the movement configuration from the given value. More...
 
bool IsMaxTranslationWithinTolerance (const StepConf &conf) noexcept
 Determines whether the maximum translation is within tolerance.
 

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. deltaTime) is correct for your use.
See also
World::Step.
Examples
World.cpp.

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.

Friends And Related Function Documentation

◆ GetMovementConf()

MovementConf GetMovementConf ( const StepConf conf)
related

Gets the movement configuration from the given value.

Returns
The maxTranslation and maxRotation fields of the given value respectively are returned.

Member Data Documentation

◆ 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.

◆ angularSleepTolerance

AngularVelocity playrho::StepConf::angularSleepTolerance = DefaultAngularSleepTolerance

Angular sleep tolerance.

Note
Used in the regular phase of step processing.

◆ angularSlop

Positive<Angle> playrho::StepConf::angularSlop = DefaultAngularSlop

Angular slop.

Note
Used in both the regular and TOI phases of step processing.

◆ DefaultLinearSlop

constexpr auto playrho::StepConf::DefaultLinearSlop = Positive<Length>{playrho::DefaultLinearSlop}
staticconstexpr

Default linear slop.

See also
DefaultTargetDepth, DefaultTolerance.

◆ DefaultTargetDepth

constexpr auto playrho::StepConf::DefaultTargetDepth = NonNegative<Length>{DefaultLinearSlop * Real(3)}
staticconstexpr

Default target depth.

See also
DefaultLinearSlop.

◆ DefaultTolerance

constexpr auto playrho::StepConf::DefaultTolerance = NonNegative<Length>{DefaultLinearSlop / Real(4)}
staticconstexpr

Default tolerance.

See also
DefaultLinearSlop.

◆ deltaTime

◆ doToi

bool playrho::StepConf::doToi = DefaultDoToi

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.

◆ doWarmStart

◆ dtRatio

◆ linearSleepTolerance

LinearVelocity playrho::StepConf::linearSleepTolerance = DefaultLinearSleepTolerance

Linear sleep tolerance.

Note
Used in the regular phase of step processing.

◆ linearSlop

Positive<Length> playrho::StepConf::linearSlop = DefaultLinearSlop

Linear slop.

Linear slop for position resolution.

Note
Used in both the regular and TOI phases of step processing.

◆ maxAngularCorrection

Angle playrho::StepConf::maxAngularCorrection = DefaultMaxAngularCorrection

Maximum angular correction.

Note
Used in both the regular and TOI phases of step processing.

◆ 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.

◆ maxDistanceIters

iteration_type playrho::StepConf::maxDistanceIters = DefaultMaxDistanceIters

Max distance iterations.

Note
Used in the TOI phase of step processing.

◆ 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.

◆ 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.

◆ 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.

◆ maxToiIters

iteration_type playrho::StepConf::maxToiIters = DefaultMaxToiIters

Max TOI iterations.

Note
Used in the TOI phase of step processing.

◆ maxToiRootIters

iteration_type playrho::StepConf::maxToiRootIters = DefaultMaxToiRootIters

Max TOI root finder iterations.

Note
Used in the TOI phase of step processing.

◆ 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.

◆ 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.

◆ regMinSeparation

Length playrho::StepConf::regMinSeparation = DefaultRegMinSeparation

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.

◆ regPositionIters

iteration_type playrho::StepConf::regPositionIters = DefaultRegPositionIters

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.

Referenced by playrho::d2::World::Step().

◆ regResolutionRate

Real playrho::StepConf::regResolutionRate = DefaultRegResolutionRate

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.

◆ regVelocityIters

iteration_type playrho::StepConf::regVelocityIters = DefaultRegVelocityIters

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.

Referenced by playrho::d2::World::Step().

◆ targetDepth

NonNegative<Length> playrho::StepConf::targetDepth = DefaultTargetDepth

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.

◆ toiMinSeparation

Length playrho::StepConf::toiMinSeparation = DefaultToiMinSeparation

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.

◆ toiPositionIters

iteration_type playrho::StepConf::toiPositionIters = DefaultToiPositionIters

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.

Referenced by playrho::d2::World::Step().

◆ toiResolutionRate

Real playrho::StepConf::toiResolutionRate = DefaultToiResolutionRate

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.

◆ toiVelocityIters

iteration_type playrho::StepConf::toiVelocityIters = DefaultToiVelocityIters

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.

Referenced by playrho::d2::World::Step().

◆ tolerance

NonNegative<Length> playrho::StepConf::tolerance = DefaultTolerance

Tolerance.

The acceptable plus or minus tolerance from the target depth for TOI calculations.

Note
Must not be subnormal.
Should be less than the target depth (targetDepth).
Used in the TOI phase of step processing.
See also
targetDepth.

◆ 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.

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