Box2D  3.0.0
A Real-Time-Oriented 2-D Physics Engine
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
box2d::StepConf Class Reference

Step configuration. More...

#include <StepConf.hpp>

Public Types

using iteration_type = ts_iters_t
 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...
 
constexpr StepConfSetTime (Time value) noexcept
 Sets the delte time and inverse time from the given value and its inverse respectively. More...
 
constexpr StepConfSetInvTime (Frequency value) noexcept
 Sets the inverse time and delta time from the given value and its inverse respectively. More...
 

Public Attributes

RealNum dtRatio = 1
 Delta time ratio. More...
 
Time minStillTimeToSleep = DefaultMinStillTimeToSleep
 Minimum still time to sleep. More...
 
Length linearSlop = DefaultLinearSlop
 Linear slop. More...
 
Angle angularSlop = DefaultAngularSlop
 Angular slop. More...
 
RealNum regResolutionRate = RealNum{2} / 10
 Regular resolution rate. More...
 
Length regMinSeparation = -DefaultLinearSlop * RealNum{3}
 Regular minimum separation. More...
 
RealNum toiResolutionRate = RealNum{75} / 100
 Time of impact resolution rate. More...
 
Length toiMinSeparation = -DefaultLinearSlop * RealNum(1.5f)
 Time of impact minimum separation. More...
 
Length targetDepth = DefaultLinearSlop * RealNum{3}
 Target depth. More...
 
Length tolerance = DefaultLinearSlop / RealNum{4}
 Tolerance. More...
 
LinearVelocity velocityThreshold = DefaultVelocityThreshold
 Velocity threshold. More...
 
RealNum maxTranslation = 4
 Maximum translation. More...
 
Angle maxRotation = Radian * (Pi / 2)
 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...
 
RealNum displaceMultiplier = DefaultDistanceMultiplier
 
Length aabbExtension = DefaultAabbExtension
 AABB extension. 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 TOI. More...
 

Static Public Attributes

static constexpr auto InvalidIteration = static_cast<iteration_type>(-1)
 Invalid iteration value. 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 96-bytes large (with 4-byte RealNum on at least one 64-bit platform).
See also
World::Step.

Member Typedef Documentation

◆ iteration_type

Step iterations type.

A type for countining iterations per-step.

Note
The special value of -1 is reserved for signifying an invalid iteration value.

Member Function Documentation

◆ GetInvTime()

Frequency box2d::StepConf::GetInvTime ( ) const
inlinenoexcept

Gets the inverse delta-t value.

Returns
1/dt or 0 if dt is 0.
See also
GetTime().

◆ GetTime()

Time box2d::StepConf::GetTime ( ) const
inlinenoexcept

Gets the delta time (time amount for this time step).

See also
SetTime(RealNum).
Returns
Time step amount in seconds.

◆ SetInvTime()

constexpr StepConf& box2d::StepConf::SetInvTime ( Frequency  value)
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
valueInverse time amount.

◆ SetTime()

constexpr StepConf& box2d::StepConf::SetTime ( Time  value)
inlinenoexcept

Sets the delte 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
valueElapsed time amount.

Member Data Documentation

◆ aabbExtension

Length box2d::StepConf::aabbExtension = DefaultAabbExtension

AABB extension.

This is the extension that will be applied to Axis Aligned Bounding Box objects used in "broadphase" collision detection. This fattens AABBs in the dynamic tree. This allows proxies to move by a small amount without triggering a tree adjustment.

Note
This is in meters.
Should be greater than 0.

◆ angularSleepTolerance

AngularVelocity box2d::StepConf::angularSleepTolerance = DefaultAngularSleepTolerance

Angular sleep tolerance.

Note
Used in the regular phase of step processing.

◆ angularSlop

Angle box2d::StepConf::angularSlop = DefaultAngularSlop

Angular slop.

Note
Must be greater than 0.
Used in both the regular and TOI phases of step processing.

◆ displaceMultiplier

RealNum box2d::StepConf::displaceMultiplier = DefaultDistanceMultiplier

◆ doToi

bool box2d::StepConf::doToi = true

Do TOI.

Whether or not to perform continuous collision detection.

Note
Used in the TOI phase of step processing.

◆ doWarmStart

bool box2d::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.

◆ dtRatio

RealNum box2d::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.

◆ InvalidIteration

constexpr auto box2d::StepConf::InvalidIteration = static_cast<iteration_type>(-1)
static

Invalid iteration value.

◆ linearSleepTolerance

LinearVelocity box2d::StepConf::linearSleepTolerance = DefaultLinearSleepTolerance

Linear sleep tolerance.

Note
Used in the regular phase of step processing.

◆ linearSlop

Length box2d::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.

◆ maxAngularCorrection

Angle box2d::StepConf::maxAngularCorrection = DefaultMaxAngularCorrection

Maximum angular correction.

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

◆ maxDistanceIters

iteration_type box2d::StepConf::maxDistanceIters = DefaultMaxDistanceIters

Max distance iterations.

Note
Used in the TOI phase of step processing.

◆ maxLinearCorrection

Length box2d::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 box2d::StepConf::maxRotation = Radian * (Pi / 2)

Maximum rotation.

The maximum angular velocity of a body.

Note
This limit is very large and is used to prevent numerical problems. You shouldn't need to adjust this.
Used in both the regular and TOI phases of step processing.

◆ maxSubSteps

iteration_type box2d::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 box2d::StepConf::maxToiIters = DefaultMaxToiIters

Max TOI iterations.

Note
Used in the TOI phase of step processing.

◆ maxToiRootIters

iteration_type box2d::StepConf::maxToiRootIters = DefaultMaxToiRootIters

Max TOI root finder iterations.

Note
Used in the TOI phase of step processing.

◆ maxTranslation

RealNum box2d::StepConf::maxTranslation = 4

Maximum translation.

The maximum linear velocity of a body.

Note
This limit is very large and is used to prevent numerical problems. You shouldn't need to adjust this.
Used in both the regular and TOI phases of step processing.

◆ minStillTimeToSleep

Time box2d::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 an invalid value to disable sleeping.
Used in the regular phase processing of the step.

◆ regMinSeparation

Length box2d::StepConf::regMinSeparation = -DefaultLinearSlop * RealNum{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.

◆ regPositionIterations

iteration_type box2d::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.

◆ regResolutionRate

RealNum box2d::StepConf::regResolutionRate = RealNum{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 box2d::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.

◆ targetDepth

Length box2d::StepConf::targetDepth = DefaultLinearSlop * RealNum{3}

Target depth.

Target depth of overlap for calculating the TOI for CCD elligible bodies.

Note
Must be greater than 0.
Must not be subnormal.
Must be less than twice the world's minimum vertex radius.
Used in the TOI phase of step processing.

◆ toiMinSeparation

Length box2d::StepConf::toiMinSeparation = -DefaultLinearSlop * RealNum(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.

◆ toiPositionIterations

iteration_type box2d::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.

◆ toiResolutionRate

RealNum box2d::StepConf::toiResolutionRate = RealNum{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 box2d::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.

◆ tolerance

Length box2d::StepConf::tolerance = DefaultLinearSlop / RealNum{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.

◆ velocityThreshold

LinearVelocity box2d::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 class was generated from the following file: