playrho::d2::RevoluteJointConf Struct Reference

Revolute joint definition. More...

#include <RevoluteJointConf.hpp>

Public Types

using super = JointBuilder< RevoluteJointConf >
 Super type. More...
 
- Public Types inherited from playrho::d2::JointBuilder< RevoluteJointConf >
using value_type = RevoluteJointConf
 Value type. More...
 
using reference = value_type &
 Reference type. More...
 

Public Member Functions

PLAYRHO_CONSTEXPR RevoluteJointConf () noexcept
 
 RevoluteJointConf (NonNull< Body * > bodyA, NonNull< Body * > bodyB, const Length2 anchor) noexcept
 Initialize the bodies, anchors, and reference angle using a world anchor point. More...
 
PLAYRHO_CONSTEXPR RevoluteJointConfUseEnableLimit (bool v) noexcept
 Uses the given enable limit state value. More...
 
PLAYRHO_CONSTEXPR RevoluteJointConfUseLowerAngle (Angle v) noexcept
 Uses the given lower angle value. More...
 
PLAYRHO_CONSTEXPR RevoluteJointConfUseUpperAngle (Angle v) noexcept
 Uses the given upper angle value. More...
 
PLAYRHO_CONSTEXPR RevoluteJointConfUseEnableMotor (bool v) noexcept
 Uses the given enable motor state value. More...
 
- Public Member Functions inherited from playrho::d2::JointBuilder< RevoluteJointConf >
PLAYRHO_CONSTEXPR JointBuilder (JointType t) noexcept
 Initializing constructor. More...
 
PLAYRHO_CONSTEXPR reference UseBodyA (Body *b) noexcept
 Use value for body A setting. More...
 
PLAYRHO_CONSTEXPR reference UseBodyB (Body *b) noexcept
 Use value for body B setting. More...
 
PLAYRHO_CONSTEXPR reference UseCollideConnected (bool v) noexcept
 Use value for collide connected setting. More...
 
PLAYRHO_CONSTEXPR reference UseUserData (void *v) noexcept
 Use value for user data setting. More...
 
- Public Member Functions inherited from playrho::d2::JointConf
 JointConf ()=delete
 Deleted default constructor for abstract base class. More...
 
PLAYRHO_CONSTEXPR JointConf (JointType t) noexcept
 Initializing constructor. More...
 

Public Attributes

Length2 localAnchorA = Length2{}
 Local anchor point relative to body A's origin. More...
 
Length2 localAnchorB = Length2{}
 Local anchor point relative to body B's origin. More...
 
Angle referenceAngle = 0_deg
 Reference angle. More...
 
bool enableLimit = false
 Flag to enable joint limits. More...
 
Angle lowerAngle = 0_deg
 Lower angle for the joint limit. More...
 
Angle upperAngle = 0_deg
 Upper angle for the joint limit. More...
 
bool enableMotor = false
 Flag to enable the joint motor. More...
 
AngularVelocity motorSpeed = 0_rpm
 Desired motor speed. More...
 
Torque maxMotorTorque = 0
 Maximum motor torque used to achieve the desired motor speed. More...
 
- Public Attributes inherited from playrho::d2::JointConf
JointType type = JointType::Unknown
 Type of the joint is set automatically for concrete joint types. More...
 
BodybodyA = nullptr
 1st attached body. More...
 
BodybodyB = nullptr
 2nd attached body. More...
 
bool collideConnected = false
 Collide connected. More...
 
void * userData = nullptr
 User data. More...
 

Additional Inherited Members

Detailed Description

Revolute joint definition.

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.

Note
The local anchor points are measured from the body's origin rather than the center of mass because:
  1. you might not know where the center of mass will be;
  2. if you add/remove shapes from a body and recompute the mass, the joints will be broken.
Examples
World.cpp.

Definition at line 46 of file RevoluteJointConf.hpp.

Member Typedef Documentation

◆ super

Constructor & Destructor Documentation

◆ RevoluteJointConf() [1/2]

PLAYRHO_CONSTEXPR playrho::d2::RevoluteJointConf::RevoluteJointConf ( )
inlinenoexcept

Definition at line 51 of file RevoluteJointConf.hpp.

◆ RevoluteJointConf() [2/2]

playrho::d2::RevoluteJointConf::RevoluteJointConf ( NonNull< Body * >  bodyA,
NonNull< Body * >  bodyB,
const Length2  anchor 
)
noexcept

Initialize the bodies, anchors, and reference angle using a world anchor point.

Definition at line 29 of file RevoluteJointConf.cpp.

Member Function Documentation

◆ UseEnableLimit()

PLAYRHO_CONSTEXPR RevoluteJointConf & playrho::d2::RevoluteJointConf::UseEnableLimit ( bool  v)
inlinenoexcept

Uses the given enable limit state value.

Definition at line 97 of file RevoluteJointConf.hpp.

◆ UseLowerAngle()

PLAYRHO_CONSTEXPR RevoluteJointConf & playrho::d2::RevoluteJointConf::UseLowerAngle ( Angle  v)
inlinenoexcept

Uses the given lower angle value.

Definition at line 103 of file RevoluteJointConf.hpp.

◆ UseUpperAngle()

PLAYRHO_CONSTEXPR RevoluteJointConf & playrho::d2::RevoluteJointConf::UseUpperAngle ( Angle  v)
inlinenoexcept

Uses the given upper angle value.

Definition at line 109 of file RevoluteJointConf.hpp.

◆ UseEnableMotor()

PLAYRHO_CONSTEXPR RevoluteJointConf & playrho::d2::RevoluteJointConf::UseEnableMotor ( bool  v)
inlinenoexcept

Uses the given enable motor state value.

Definition at line 115 of file RevoluteJointConf.hpp.

Member Data Documentation

◆ localAnchorA

Length2 playrho::d2::RevoluteJointConf::localAnchorA = Length2{}

Local anchor point relative to body A's origin.

Definition at line 69 of file RevoluteJointConf.hpp.

◆ localAnchorB

Length2 playrho::d2::RevoluteJointConf::localAnchorB = Length2{}

Local anchor point relative to body B's origin.

Definition at line 72 of file RevoluteJointConf.hpp.

◆ referenceAngle

Angle playrho::d2::RevoluteJointConf::referenceAngle = 0_deg

Reference angle.

This is the body-B angle minus body-A angle in the reference state (radians).

Definition at line 76 of file RevoluteJointConf.hpp.

◆ enableLimit

bool playrho::d2::RevoluteJointConf::enableLimit = false

Flag to enable joint limits.

Definition at line 79 of file RevoluteJointConf.hpp.

◆ lowerAngle

Angle playrho::d2::RevoluteJointConf::lowerAngle = 0_deg

Lower angle for the joint limit.

Definition at line 82 of file RevoluteJointConf.hpp.

◆ upperAngle

Angle playrho::d2::RevoluteJointConf::upperAngle = 0_deg

Upper angle for the joint limit.

Definition at line 85 of file RevoluteJointConf.hpp.

◆ enableMotor

bool playrho::d2::RevoluteJointConf::enableMotor = false

Flag to enable the joint motor.

Definition at line 88 of file RevoluteJointConf.hpp.

◆ motorSpeed

AngularVelocity playrho::d2::RevoluteJointConf::motorSpeed = 0_rpm

Desired motor speed.

Definition at line 91 of file RevoluteJointConf.hpp.

◆ maxMotorTorque

Torque playrho::d2::RevoluteJointConf::maxMotorTorque = 0

Maximum motor torque used to achieve the desired motor speed.

Definition at line 94 of file RevoluteJointConf.hpp.


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