GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::physics::SimulationOptions< N > Struct Template Reference

Configuration options for a Simulation. More...

#include <GREM/physics/Simulation.hpp>

Public Attributes

Time stepInterval = Scalar{1} / (Scalar{60} * HERTZ)
 Time delta to advance the state of the world by on each simulation step.
execution::Task::ParallelCount targetParallelism = static_cast<execution::Task::ParallelCount>(clamp(Thread::hardware_concurrency(), 2u, 16u) - 1)
 Assumed level of parallelism available when a simulation step is scheduled, and also later when the schedule is executed.
size_t subStepCount = 8
 How many sub-steps of the constraint solver to run in the simulation step.
size_t contactColorCount = (targetParallelism >= 2) ? MAX_CONTACT_COLOR_COUNT : 0
 Number of contact colors to use for graph coloring in order to parallelize the solvers.
CollisionAlgorithmOptions< N > collisionAlgorithmOptions {}
 Collision algorithm options.
Angle maxContactManifoldAngleTolerance = Scalar{20} * DEGREES
 Maximum angle between the normals of the old and new versions of a contact manifold before they're considered to be different manifolds and the old accumulated contact momentums are discarded.
Distance minObjectSizeApproximation = Scalar{0.01} * METERS
 Approximation of the minimum width of the shapes of the objects that will be simulated (excluding point shapes).
Speed maxRestingSpeed = Scalar{0.1} * METERS_PER_SECOND
 Linear speed at or below which objects are considered to be at rest.
AngularSpeed maxRestingAngularSpeed = Scalar{4} * DEGREES_PER_SECOND
 Angular speed at or below which objects are considered to be at rest.
Time restingTimeThreshold = Scalar{1} * SECONDS
 How long an object with resting enabled can spend below resting speed before it gets flagged as inactive.
Coefficient potentialCollisionVelocitySafetyCoefficient = Scalar{2}
 Safety coefficient to multiply the velocities of objects by when building their bounding volumes, which are used to detect potential collisions, for the full step.
Coefficient contactWarmstartCoefficient = Scalar{0.99}
 How much of the contact constraint momentums from the last simulation step to preserve to the current step for the purpose of improving convergence in the constraint solver.
Coefficient jointWarmstartCoefficient = Scalar{0.99}
 How much of the joint constraint momentums from the last simulation step to preserve to the current step for the purpose of improving convergence in the constraint solver.
Frequency contactStiffness = Scalar{60} * HERTZ
 Stiffness of contact constraints.
Coefficient contactDampingRatio = Scalar{2}
 Damping ratio used when solving contact constraints.
Momentum jointMaxMomentum = Scalar{50000} * KILOGRAM_METERS_PER_SECOND
 Maximum linear momentum limit of joint constraints.
AngularMomentum2D jointMaxAngularMomentum = Scalar{50000} * KILOGRAM_SQUARE_METERS_PER_SECOND
 Maximum angular momentum limit of joint constraints.
Momentum contactMaxMomentum = Scalar{50000} * KILOGRAM_METERS_PER_SECOND
 Maximum momentum limit of contact constraints.

Static Public Attributes

static constexpr size_t MAX_CONTACT_COLOR_COUNT = N * 4
 Maximum supported number of contact colors.

Detailed Description

template<size_t N>
struct grem::physics::SimulationOptions< N >

Configuration options for a Simulation.

Template Parameters
Nnumber of dimensions of the world space (must be 2 or 3).

Member Data Documentation

◆ MAX_CONTACT_COLOR_COUNT

template<size_t N>
size_t grem::physics::SimulationOptions< N >::MAX_CONTACT_COLOR_COUNT = N * 4
staticconstexpr

Maximum supported number of contact colors.

◆ stepInterval

template<size_t N>
Time grem::physics::SimulationOptions< N >::stepInterval = Scalar{1} / (Scalar{60} * HERTZ)

Time delta to advance the state of the world by on each simulation step.

Warning
Must be positive.

◆ targetParallelism

Assumed level of parallelism available when a simulation step is scheduled, and also later when the schedule is executed.

Note
Should roughly correspond to the maximum parallelism of the executor that the simulation is executed on, which can be queried with execution::Executor::getMaxParallelism().

◆ subStepCount

template<size_t N>
size_t grem::physics::SimulationOptions< N >::subStepCount = 8

How many sub-steps of the constraint solver to run in the simulation step.

Warning
Must be positive.

◆ contactColorCount

template<size_t N>
size_t grem::physics::SimulationOptions< N >::contactColorCount = (targetParallelism >= 2) ? MAX_CONTACT_COLOR_COUNT : 0

Number of contact colors to use for graph coloring in order to parallelize the solvers.

Warning
Must be less than or equal to MAX_CONTACT_COLOR_COUNT.

◆ collisionAlgorithmOptions

template<size_t N>
CollisionAlgorithmOptions<N> grem::physics::SimulationOptions< N >::collisionAlgorithmOptions {}

Collision algorithm options.

◆ maxContactManifoldAngleTolerance

template<size_t N>
Angle grem::physics::SimulationOptions< N >::maxContactManifoldAngleTolerance = Scalar{20} * DEGREES

Maximum angle between the normals of the old and new versions of a contact manifold before they're considered to be different manifolds and the old accumulated contact momentums are discarded.

Warning
Must be non-negative.
Must be less than 90 degrees.

◆ minObjectSizeApproximation

template<size_t N>
Distance grem::physics::SimulationOptions< N >::minObjectSizeApproximation = Scalar{0.01} * METERS

Approximation of the minimum width of the shapes of the objects that will be simulated (excluding point shapes).

Objects smaller than this are allowed, but may cause worse performance.

Warning
Must be non-negative.

◆ maxRestingSpeed

template<size_t N>
Speed grem::physics::SimulationOptions< N >::maxRestingSpeed = Scalar{0.1} * METERS_PER_SECOND

Linear speed at or below which objects are considered to be at rest.

When an object has resting enabled, going below this speed and maxRestingAngularSpeed at the same time causes its ObjectActivity::stepsResting counter to increase until it is eventually frozen in place after the restingTimeThreshold.

Warning
Must be non-negative.

◆ maxRestingAngularSpeed

template<size_t N>
AngularSpeed grem::physics::SimulationOptions< N >::maxRestingAngularSpeed = Scalar{4} * DEGREES_PER_SECOND

Angular speed at or below which objects are considered to be at rest.

When an object has resting enabled, going below this speed and maxRestingSpeed at the same time causes its ObjectActivity::stepsResting counter to increase until it is eventually frozen in place after the restingTimeThreshold.

Warning
Must be non-negative.

◆ restingTimeThreshold

template<size_t N>
Time grem::physics::SimulationOptions< N >::restingTimeThreshold = Scalar{1} * SECONDS

How long an object with resting enabled can spend below resting speed before it gets flagged as inactive.

Warning
Must be positive.
Note
Values above 65535 * stepInterval are treated as if they were clamped to that value.

◆ potentialCollisionVelocitySafetyCoefficient

template<size_t N>
Coefficient grem::physics::SimulationOptions< N >::potentialCollisionVelocitySafetyCoefficient = Scalar{2}

Safety coefficient to multiply the velocities of objects by when building their bounding volumes, which are used to detect potential collisions, for the full step.

This aims to account for potential acceleration changes during the step.

Warning
Must be non-negative.

◆ contactWarmstartCoefficient

template<size_t N>
Coefficient grem::physics::SimulationOptions< N >::contactWarmstartCoefficient = Scalar{0.99}

How much of the contact constraint momentums from the last simulation step to preserve to the current step for the purpose of improving convergence in the constraint solver.

Warning
Must be between 0 and 1 (inclusive).

◆ jointWarmstartCoefficient

template<size_t N>
Coefficient grem::physics::SimulationOptions< N >::jointWarmstartCoefficient = Scalar{0.99}

How much of the joint constraint momentums from the last simulation step to preserve to the current step for the purpose of improving convergence in the constraint solver.

Warning
Must be between 0 and 1 (inclusive).

◆ contactStiffness

template<size_t N>
Frequency grem::physics::SimulationOptions< N >::contactStiffness = Scalar{60} * HERTZ

Stiffness of contact constraints.

Controls how fast overlap is corrected on the velocity level, at the cost of potential jitter.

Warning
Must be non-negative.

◆ contactDampingRatio

template<size_t N>
Coefficient grem::physics::SimulationOptions< N >::contactDampingRatio = Scalar{2}

Damping ratio used when solving contact constraints.

Warning
Must be positive.

◆ jointMaxMomentum

template<size_t N>
Momentum grem::physics::SimulationOptions< N >::jointMaxMomentum = Scalar{50000} * KILOGRAM_METERS_PER_SECOND

Maximum linear momentum limit of joint constraints.

Warning
Must be positive.

◆ jointMaxAngularMomentum

template<size_t N>
AngularMomentum2D grem::physics::SimulationOptions< N >::jointMaxAngularMomentum = Scalar{50000} * KILOGRAM_SQUARE_METERS_PER_SECOND

Maximum angular momentum limit of joint constraints.

Warning
Must be positive.

◆ contactMaxMomentum

template<size_t N>
Momentum grem::physics::SimulationOptions< N >::contactMaxMomentum = Scalar{50000} * KILOGRAM_METERS_PER_SECOND

Maximum momentum limit of contact constraints.

Warning
Must be positive.

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