Revolute joint definition. More...
#include <playrho/d2/RevoluteJointConf.hpp>
Public Types | |
using | super = JointBuilder< RevoluteJointConf > |
Super type. | |
Public Types inherited from playrho::d2::JointBuilder< RevoluteJointConf > | |
using | reference = value_type & |
Reference type. | |
using | value_type = RevoluteJointConf |
Value type. | |
Public Member Functions | |
constexpr | RevoluteJointConf () noexcept=default |
Default constructor. | |
RevoluteJointConf (BodyID bA, BodyID bB, const Length2 &laA=Length2{}, const Length2 &laB=Length2{}, Angle ra=0_deg) noexcept | |
Initialize the bodies, anchors, and reference angle using a world anchor point. | |
constexpr auto & | UseEnableLimit (bool v) noexcept |
Uses the given enable limit state value. | |
constexpr auto & | UseEnableMotor (bool v) noexcept |
Uses the given enable motor state value. | |
constexpr auto & | UseLowerAngle (Angle v) noexcept |
Uses the given lower angle value. | |
constexpr auto & | UseMaxMotorTorque (Torque v) noexcept |
Uses the given max motor torque value. | |
constexpr auto & | UseMotorSpeed (AngularVelocity v) noexcept |
Uses the given motor speed value. | |
constexpr auto & | UseUpperAngle (Angle v) noexcept |
Uses the given upper angle value. | |
Public Member Functions inherited from playrho::d2::JointBuilder< RevoluteJointConf > | |
constexpr reference | UseBodyA (BodyID b) noexcept |
Use value for body A setting. | |
constexpr reference | UseBodyB (BodyID b) noexcept |
Use value for body B setting. | |
constexpr reference | UseCollideConnected (bool v) noexcept |
Use value for collide connected setting. | |
Public Attributes | |
RotInertia | angularMass = {} |
Effective mass for motor/limit angular constraint. | |
AngularMomentum | angularMotorImpulse = {} |
Motor impulse. More... | |
bool | enableLimit = false |
Flag to enable joint limits. | |
bool | enableMotor = false |
Flag to enable the joint motor. | |
Vec3 | impulse = Vec3{} |
Impulse. More... | |
LimitState | limitState = LimitState::e_inactiveLimit |
Limit state. | |
Length2 | localAnchorA = Length2{} |
Local anchor point relative to body A's origin. | |
Length2 | localAnchorB = Length2{} |
Local anchor point relative to body B's origin. | |
Angle | lowerAngle = 0_deg |
Lower angle for the joint limit. | |
Mat33 | mass = {} |
Effective mass for point-to-point constraint. | |
Torque | maxMotorTorque = 0_Nm |
Maximum motor torque used to achieve the desired motor speed. | |
AngularVelocity | motorSpeed = 0_rpm |
Desired motor speed. | |
Length2 | rA = {} |
Rotated delta of body A's local center from local anchor A. | |
Length2 | rB = {} |
Rotated delta of body B's local center from local anchor B. | |
Angle | referenceAngle = 0_deg |
Reference angle. More... | |
Angle | upperAngle = 0_deg |
Upper angle for the joint limit. | |
Public Attributes inherited from playrho::d2::JointConf | |
BodyID | bodyA = InvalidBodyID |
1st attached body. | |
BodyID | bodyB = InvalidBodyID |
2nd attached body. | |
bool | collideConnected = false |
Collide connected. More... | |
Related Functions | |
(Note that these are not member functions.) | |
constexpr Angle | GetAngularLowerLimit (const RevoluteJointConf &conf) noexcept |
Free function for getting the angular lower limit value of the given configuration. | |
constexpr AngularMomentum | GetAngularReaction (const RevoluteJointConf &conf) noexcept |
Gets the current angular reaction of the given configuration. | |
constexpr Angle | GetAngularUpperLimit (const RevoluteJointConf &conf) noexcept |
Free function for getting the angular upper limit value of the given configuration. | |
constexpr Momentum2 | GetLinearReaction (const RevoluteJointConf &conf) noexcept |
Gets the current linear reaction of the given configuration. | |
void | InitVelocity (RevoluteJointConf &object, const Span< BodyConstraint > &bodies, const StepConf &step, const ConstraintSolverConf &conf) |
Initializes velocity constraint data based on the given solver data. More... | |
constexpr void | SetAngularLimits (RevoluteJointConf &object, Angle lower, Angle upper) noexcept |
Free function for setting the angular limits of the given configuration. | |
constexpr void | SetMaxMotorTorque (RevoluteJointConf &object, Torque value) |
Free function for setting the max motor torque of the given configuration. | |
constexpr auto | ShiftOrigin (RevoluteJointConf &, const Length2 &) noexcept |
Shifts the origin notion of the given configuration. | |
bool | SolvePosition (const RevoluteJointConf &object, const Span< BodyConstraint > &bodies, const ConstraintSolverConf &conf) |
Solves the position constraint. More... | |
bool | SolveVelocity (RevoluteJointConf &object, const Span< BodyConstraint > &bodies, const StepConf &step) |
Solves velocity constraint. More... | |
Related Functions inherited from playrho::d2::JointConf | |
void | Set (JointConf &def, const Joint &joint) noexcept |
Sets the joint definition data for the given joint. | |
Revolute joint definition.
A revolute joint constrains two bodies to share a common point while they are free to rotate about the point. The relative rotation about the shared point is the joint angle. This requires defining an anchor point where the bodies are joined. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. You also need to specify the initial relative angle for joint limits. This helps when saving and loading a game.
|
related |
Initializes velocity constraint data based on the given solver data.
SolveVelocity
. object | Configuration object. bodyA and bodyB must index bodies within the given bodies container or be the special body ID value of InvalidBodyID . |
bodies | Container of body constraints. |
step | Configuration for the step. |
conf | Constraint solver configuration. |
std::out_of_range | If the given object's bodyA or bodyB values are not InvalidBodyID and are not indices within range of the given bodies container. |
|
related |
Solves the position constraint.
object | Configuration object. bodyA and bodyB must index bodies within the given bodies container or be the special body ID value of InvalidBodyID . |
bodies | Container of body constraints. |
conf | Constraint solver configuration. |
std::out_of_range | If the given object's bodyA or bodyB values are not InvalidBodyID and are not indices within range of the given bodies container. |
true
if the position errors are within tolerance.
|
related |
Solves velocity constraint.
InitVelocity
has been called. object | Configuration object. bodyA and bodyB must index bodies within the given bodies container or be the special body ID value of InvalidBodyID . |
bodies | Container of body constraints. |
step | Configuration for the step. |
std::out_of_range | If the given object's bodyA or bodyB values are not InvalidBodyID and are not indices within range of the given bodies container. |
true
if velocity is "solved", false
otherwise. AngularMomentum playrho::d2::RevoluteJointConf::angularMotorImpulse = {} |
Motor impulse.
InitVelocity
, SolveVelocity
. Impulse.
InitVelocity
, SolveVelocityConstraints
. Angle playrho::d2::RevoluteJointConf::referenceAngle = 0_deg |
Reference angle.
This is the body-B angle minus body-A angle in the reference state (radians).