Prismatic joint definition. More...
#include <PrismaticJointConf.hpp>
Public Types | |
using | super = JointBuilder< PrismaticJointConf > |
Super type. | |
Public Types inherited from playrho::d2::JointBuilder< PrismaticJointConf > | |
using | value_type = PrismaticJointConf |
Value type. | |
using | reference = value_type & |
Reference type. | |
Public Member Functions | |
constexpr | PrismaticJointConf ()=default |
Default constructor. | |
PrismaticJointConf (const PrismaticJointConf ©)=default | |
Copy constructor. | |
PrismaticJointConf (BodyID bA, BodyID bB, Length2 laA=Length2{}, Length2 laB=Length2{}, UnitVec axisA=UnitVec::GetRight(), Angle angle=0_deg) noexcept | |
Initializing constructor. More... | |
constexpr auto & | UseEnableLimit (bool v) noexcept |
Uses the given enable limit state value. | |
constexpr auto & | UseLowerLength (Length v) noexcept |
Uses the given lower translation value. | |
constexpr auto & | UseUpperLength (Length v) noexcept |
Uses the given upper translation value. | |
constexpr auto & | UseEnableMotor (bool v) noexcept |
Uses the given enable motor state value. | |
constexpr auto & | UseMotorSpeed (AngularVelocity v) noexcept |
Uses the given motor speed value. | |
constexpr auto & | UseMaxMotorForce (Force v) noexcept |
Uses the given max motor force value. | |
Public Member Functions inherited from playrho::d2::JointBuilder< PrismaticJointConf > | |
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 | |
Length2 | localAnchorA = Length2{} |
The local anchor point relative to body A's origin. | |
Length2 | localAnchorB = Length2{} |
The local anchor point relative to body B's origin. | |
UnitVec | localXAxisA = UnitVec::GetRight() |
The local X translation unit axis in body A. | |
UnitVec | localYAxisA = GetRevPerpendicular(UnitVec::GetRight()) |
The local Y translation unit axis in body A. | |
Angle | referenceAngle = 0_deg |
The constrained angle between the bodies: body B's angle minus body A's angle. | |
Vec3 | impulse = Vec3{} |
Impulse. | |
Momentum | motorImpulse = 0 |
Motor impulse. | |
bool | enableLimit = false |
Enable/disable the joint limit. | |
Length | lowerTranslation = 0_m |
The lower translation limit. | |
Length | upperTranslation = 0_m |
The upper translation limit. | |
bool | enableMotor = false |
Enable/disable the joint motor. | |
Force | maxMotorForce = 0_N |
The maximum motor force. | |
AngularVelocity | motorSpeed = 0_rpm |
The desired angular motor speed. | |
LimitState | limitState = LimitState::e_inactiveLimit |
Limit state. | |
UnitVec | axis = UnitVec::GetZero() |
Axis. | |
UnitVec | perp = UnitVec::GetZero() |
Perpendicular. | |
Length | s1 = 0_m |
Location S-1. | |
Length | s2 = 0_m |
Location S-2. | |
Length | a1 = 0_m |
Location A-1. | |
Length | a2 = 0_m |
Location A-2. | |
Mat33 | K = {} |
K matrix. | |
Mass | motorMass = 0_kg |
Motor mass. | |
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 auto | GetLinearLowerLimit (const PrismaticJointConf &conf) noexcept |
Free function for getting the linear lower limit value of the given configuration. | |
constexpr auto | GetLinearUpperLimit (const PrismaticJointConf &conf) noexcept |
Free function for getting the linear upper limit value of the given configuration. | |
constexpr void | SetLinearLimits (PrismaticJointConf &conf, Length lower, Length upper) noexcept |
Free function for setting the linear limits of the given configuration. | |
constexpr auto | ShiftOrigin (PrismaticJointConf &, Length2) noexcept |
Shifts the origin notion of the given configuration. | |
Momentum2 | GetLinearReaction (const PrismaticJointConf &conf) |
Gets the current linear reaction of the given configuration. | |
AngularMomentum | GetAngularReaction (const PrismaticJointConf &conf) |
Gets the current angular reaction of the given configuration. | |
void | InitVelocity (PrismaticJointConf &object, std::vector< BodyConstraint > &bodies, const StepConf &step, const ConstraintSolverConf &conf) |
Initializes velocity constraint data based on the given solver data. More... | |
bool | SolveVelocity (PrismaticJointConf &object, std::vector< BodyConstraint > &bodies, const StepConf &step) |
Solves velocity constraint. More... | |
bool | SolvePosition (const PrismaticJointConf &object, std::vector< BodyConstraint > &bodies, const ConstraintSolverConf &conf) |
Solves the position constraint. More... | |
constexpr void | SetMaxMotorForce (PrismaticJointConf &object, Force value) |
Free function for setting the maximum motor torque value of the given configuration. | |
Related Functions inherited from playrho::d2::JointConf | |
void | Set (JointConf &def, const Joint &joint) noexcept |
Sets the joint definition data for the given joint. | |
Prismatic joint definition.
This joint provides one degree of freedom: translation along an axis fixed in body-A. Relative rotation is prevented. This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space. Using local anchors and a local axis helps when saving and loading a game.
|
noexcept |
Initializing constructor.
Initializes the bodies, anchors, axis, and reference angle using the world anchor and unit world axis.
|
related |
Initializes velocity constraint data based on the given solver data.
SolveVelocity
.
|
related |
Solves the position constraint.
true
if the position errors are within tolerance.
|
related |
Solves velocity constraint.
InitVelocity
has been called. true
if velocity is "solved", false
otherwise.