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

Constraint solver configuration data. More...

#include <playrho/ConstraintSolverConf.hpp>

Public Member Functions

constexpr ConstraintSolverConf & UseAngularSlop (Angle value) noexcept
 Uses the given angular slop.
 
constexpr ConstraintSolverConf & UseLinearSlop (Length value) noexcept
 Uses the given linear slop.
 
constexpr ConstraintSolverConf & UseMaxAngularCorrection (Angle value) noexcept
 Uses the given max angular correction.
 
constexpr ConstraintSolverConf & UseMaxLinearCorrection (Length value) noexcept
 Uses the given max linear correction.
 
constexpr ConstraintSolverConf & UseResolutionRate (Real value) noexcept
 Uses the given resolution rate.
 

Public Attributes

Angle angularSlop = DefaultAngularSlop
 
Length linearSlop = DefaultLinearSlop
 
Angle maxAngularCorrection = DefaultMaxAngularCorrection
 
Length maxLinearCorrection = DefaultMaxLinearCorrection
 
Real resolutionRate = DefaultRegResolutionRate
 

Static Public Attributes

static constexpr auto DefaultAngularSlop = ::playrho::DefaultAngularSlop
 Default angular slop.
 
static constexpr auto DefaultLinearSlop = ::playrho::DefaultLinearSlop
 Default linear slop.
 
static constexpr auto DefaultMaxAngularCorrection = DefaultAngularSlop * Real{4}
 Default max angular correction.
 
static constexpr auto DefaultMaxLinearCorrection = DefaultLinearSlop * Real{20}
 Default max linear correction.
 
static constexpr auto DefaultRegResolutionRate = Real(0.2)
 Default regular resolution rate.
 
static constexpr auto DefaultToiResolutionRate = Real(0.75)
 Default time of impact (TOI) resolution rate.
 

Detailed Description

Constraint solver configuration data.

Defines how a constraint solver should resolve a given constraint.

See also
SolvePositionConstraint.

Member Data Documentation

◆ angularSlop

◆ linearSlop

◆ maxAngularCorrection

Angle playrho::ConstraintSolverConf::maxAngularCorrection = DefaultMaxAngularCorrection

Maximum angular correction.

Maximum angular position correction used when solving constraints. Helps to prevent overshoot.

Note
Recommended value: angularSlop * 4.

Referenced by playrho::d2::Position::Cap(), playrho::d2::RevoluteJointConf::SolvePosition(), and UseMaxAngularCorrection().

◆ maxLinearCorrection

Length playrho::ConstraintSolverConf::maxLinearCorrection = DefaultMaxLinearCorrection

Maximum linear correction.

Maximum amount of overlap to resolve in a single solver call. Helps prevent overshoot.

Note
Recommended value: linearSlop * 40.

Referenced by playrho::d2::Position::Cap(), playrho::d2::DistanceJointConf::SolvePosition(), playrho::d2::PrismaticJointConf::SolvePosition(), playrho::d2::RopeJointConf::SolvePosition(), playrho::GaussSeidel::SolvePositionConstraint(), and UseMaxLinearCorrection().

◆ resolutionRate

Real playrho::ConstraintSolverConf::resolutionRate = DefaultRegResolutionRate

Resolution rate.

Defines the percentage of the overlap that should get resolved in a single solver call. Value greater than zero and less than or equal to one. Ideally this would be 1 so that overlap is removed in one time step. However using values close to 1 often leads to overshoot.

Note
Recommended values are: 0.2 for solving regular constraints or 0.75 for solving TOI constraints.

Referenced by playrho::d2::GearJointConf::SolvePosition(), playrho::GaussSeidel::SolvePositionConstraint(), and UseResolutionRate().


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