PlayRho  1.1.0
An Interactive Real-Time-Oriented C++ Physics Engine & Library
playrho::StepConf Struct Reference

Step configuration. More...

#include <StepConf.hpp>

Collaboration diagram for playrho::StepConf:
[legend]

Public Types

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

Public Attributes

Time deltaTime = DefaultStepTime
 Delta time. More...
 
Real dtRatio = 1
 Delta time ratio. More...
 
Time minStillTimeToSleep = DefaultMinStillTimeToSleep
 Minimum still time to sleep. More...
 
Positive< LengthlinearSlop = DefaultLinearSlop
 Linear slop. More...
 
Positive< AngleangularSlop = DefaultAngularSlop
 Angular slop. More...
 
Real regResolutionRate = Real{2} / 10
 Regular resolution rate. More...
 
Length regMinSeparation = -DefaultLinearSlop * Real{3}
 Regular minimum separation. More...
 
Momentum regMinMomentum = DefaultRegMinMomentum
 Regular-phase minimum momentum.
 
Real toiResolutionRate = Real{75} / 100
 Time of impact resolution rate. More...
 
Length toiMinSeparation = -DefaultLinearSlop * Real(1.5f)
 Time of impact minimum separation. More...
 
Momentum toiMinMomentum = DefaultToiMinMomentum
 TOI-phase minimum momentum.
 
Length targetDepth = DefaultLinearSlop * Real{3}
 Target depth. More...
 
NonNegative< Lengthtolerance = DefaultLinearSlop / Real{4}
 Tolerance. More...
 
LinearVelocity velocityThreshold = DefaultVelocityThreshold
 Velocity threshold. More...
 
Length maxTranslation = DefaultMaxTranslation
 Maximum translation. More...
 
Angle maxRotation = DefaultMaxRotation
 Maximum rotation. More...
 
Length maxLinearCorrection = DefaultMaxLinearCorrection
 Maximum linear correction. More...
 
Angle maxAngularCorrection = DefaultMaxAngularCorrection
 Maximum angular correction. More...
 
LinearVelocity linearSleepTolerance = DefaultLinearSleepTolerance
 Linear sleep tolerance. More...
 
AngularVelocity angularSleepTolerance = DefaultAngularSleepTolerance
 Angular sleep tolerance. More...
 
Real displaceMultiplier = DefaultDistanceMultiplier
 Displacement multiplier for directional AABB fattening.
 
Length aabbExtension = DefaultAabbExtension
 AABB extension. More...
 
Real maxCirclesRatio = DefaultCirclesRatio
 Max. circles ratio. More...
 
iteration_type regVelocityIterations = 8
 Regular velocity iterations. More...
 
iteration_type regPositionIterations = 3
 Regular position iterations. More...
 
iteration_type toiVelocityIterations = 8
 TOI velocity iterations. More...
 
iteration_type toiPositionIterations = 20
 TOI position iterations. More...
 
iteration_type maxToiRootIters = DefaultMaxToiRootIters
 Max TOI root finder iterations. More...
 
iteration_type maxToiIters = DefaultMaxToiIters
 Max TOI iterations. More...
 
iteration_type maxDistanceIters = DefaultMaxDistanceIters
 Max distance iterations. More...
 
iteration_type maxSubSteps = DefaultMaxSubSteps
 Maximum sub steps. More...
 
bool doWarmStart = true
 Do warm start. More...
 
bool doToi = true
 Do time of impact (TOI) calculations. More...
 
bool doBlocksolve = true
 Do the block-solve algorithm.
 

Static Public Attributes

static constexpr auto InvalidIteration = static_cast<iteration_type>(-1)
 Invalid iteration value.
 

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.
 
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.
This data structure is 104-bytes large (with 4-byte Real on at least one 64-bit platform).
See also
World::Step.
Examples
DistanceJoint.cpp, FrictionJoint.cpp, MotorJoint.cpp, PulleyJoint.cpp, RevoluteJoint.cpp, RopeJoint.cpp, TargetJoint.cpp, WeldJoint.cpp, WheelJoint.cpp, World.cpp, and WorldContact.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.
Examples
World.cpp.

Referenced by playrho::d2::WorldImpl::SolveReg(), playrho::d2::WorldImpl::SolveToi(), playrho::d2::WorldImpl::Step(), and playrho::d2::WorldImpl::SynchronizeProxies().

◆ 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
Must be greater than 0.
Used in both the regular and TOI phases of step processing.

◆ deltaTime

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

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

◆ 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.
Examples
FrictionJoint.cpp, RopeJoint.cpp, WeldJoint.cpp, and WheelJoint.cpp.

Referenced by playrho::d2::InitVelocity(), and playrho::d2::WorldImpl::SolveRegIslandViaGS().

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

Referenced by playrho::d2::InitVelocity(), and playrho::d2::Step().

◆ 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
Must be greater than 0.
Used in both the regular and TOI phases of step processing.
Examples
World.cpp.

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

◆ maxAngularCorrection

Angle playrho::StepConf::maxAngularCorrection = DefaultMaxAngularCorrection

Maximum angular correction.

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

◆ 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.
Examples
World.cpp.

◆ 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.
Examples
World.cpp.

Referenced by playrho::d2::WorldImpl::UpdateContactTOIs().

◆ 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.
Examples
World.cpp.

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

Referenced by playrho::d2::WorldImpl::SolveRegIslandViaGS().

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

Referenced by playrho::d2::WorldImpl::SolveRegIslandViaGS().

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

Referenced by playrho::d2::WorldImpl::SolveRegIslandViaGS(), and playrho::d2::Step().

◆ regResolutionRate

Real playrho::StepConf::regResolutionRate = Real{2} / 10

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.

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

Referenced by playrho::d2::WorldImpl::SolveRegIslandViaGS(), and playrho::d2::Step().

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

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

Referenced by playrho::d2::WorldImpl::SolveToiViaGS().

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

Referenced by playrho::d2::WorldImpl::SolveToiViaGS(), and playrho::d2::Step().

◆ toiResolutionRate

Real playrho::StepConf::toiResolutionRate = Real{75} / 100

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.

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

Referenced by playrho::d2::WorldImpl::SolveToiViaGS(), and playrho::d2::Step().

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

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

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