PlayRho  1.1.0
An Interactive Real-Time-Oriented C++ Physics Engine & Library
playrho::d2::RopeJointConf Struct Reference

Rope joint definition. More...

#include <RopeJointConf.hpp>

Inheritance diagram for playrho::d2::RopeJointConf:
[legend]
Collaboration diagram for playrho::d2::RopeJointConf:
[legend]

Public Types

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

Public Member Functions

constexpr RopeJointConf ()=default
 Default constructor.
 
constexpr RopeJointConf (BodyID bodyA, BodyID bodyB) noexcept
 Initializing constructor.
 
constexpr auto & UseMaxLength (Length v) noexcept
 Uses the given max length value.
 
- Public Member Functions inherited from playrho::d2::JointBuilder< RopeJointConf >
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{-1_m, 0_m}
 The local anchor point relative to body A's origin.
 
Length2 localAnchorB = Length2{+1_m, 0_m}
 The local anchor point relative to body B's origin.
 
Length maxLength = 0_m
 The maximum length of the rope.
 
Length length = 0
 Length.
 
Momentum impulse = 0_Ns
 Impulse.
 
UnitVec u
 U direction.
 
Length2 rA = {}
 Relative A.
 
Length2 rB = {}
 Relative B.
 
Mass mass = 0_kg
 Mass.
 
LimitState limitState = LimitState::e_inactiveLimit
 Limit state.
 
- 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 Momentum2 GetLinearReaction (const RopeJointConf &object) noexcept
 Gets the current linear reaction of the given configuration.
 
constexpr AngularMomentum GetAngularReaction (const RopeJointConf &) noexcept
 Gets the current angular reaction of the given configuration.
 
constexpr auto ShiftOrigin (RopeJointConf &, Length2) noexcept
 Shifts the origin notion of the given configuration.
 
void InitVelocity (RopeJointConf &object, std::vector< BodyConstraint > &bodies, const StepConf &step, const ConstraintSolverConf &conf)
 Initializes velocity constraint data based on the given solver data. More...
 
bool SolveVelocity (RopeJointConf &object, std::vector< BodyConstraint > &bodies, const StepConf &step)
 Solves velocity constraint. More...
 
bool SolvePosition (const RopeJointConf &object, std::vector< BodyConstraint > &bodies, const ConstraintSolverConf &conf)
 Solves the position constraint. More...
 
constexpr auto GetMaxLength (const RopeJointConf &object) noexcept
 Free function for getting the maximum length value of the given configuration.
 
constexpr auto SetMaxLength (RopeJointConf &object, Length value) noexcept
 Free function for setting the maximum length value of the given configuration.
 

Detailed Description

Rope joint definition.

A rope joint enforces a maximum distance between two points on two bodies. It has no other effect. This requires two body anchor points and a maximum lengths.

Note
By default the connected objects will not collide.
Warning
If you attempt to change the maximum length during the simulation you will get some non-physical behavior. A model that would allow you to dynamically modify the length would have some sponginess, so it was decided not to implement it that way. See DistanceJoint if you want to dynamically control length.
See also
collideConnected in JointConf.
Joint, World::CreateJoint
Examples
RopeJoint.cpp, and World.cpp.

Friends And Related Function Documentation

◆ InitVelocity()

void InitVelocity ( RopeJointConf object,
std::vector< BodyConstraint > &  bodies,
const StepConf step,
const ConstraintSolverConf conf 
)
related

Initializes velocity constraint data based on the given solver data.

Note
This MUST be called prior to calling SolveVelocity.
See also
SolveVelocity.

◆ SolvePosition()

bool SolvePosition ( const RopeJointConf object,
std::vector< BodyConstraint > &  bodies,
const ConstraintSolverConf conf 
)
related

Solves the position constraint.

Returns
true if the position errors are within tolerance.

◆ SolveVelocity()

bool SolveVelocity ( RopeJointConf object,
std::vector< BodyConstraint > &  bodies,
const StepConf step 
)
related

Solves velocity constraint.

Precondition
InitVelocity has been called.
See also
InitVelocity.
Returns
true if velocity is "solved", false otherwise.

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