Target joint definition. More...
#include <playrho/d2/TargetJointConf.hpp>
Public Types | |
using | super = JointBuilder< TargetJointConf > |
Super type. | |
Public Types inherited from playrho::d2::JointBuilder< TargetJointConf > | |
using | reference = value_type & |
Reference type. | |
using | value_type = TargetJointConf |
Value type. | |
Public Member Functions | |
constexpr | TargetJointConf () noexcept=default |
Default constructor. | |
constexpr | TargetJointConf (BodyID b) noexcept |
Initializing constructor. | |
constexpr auto & | UseAnchor (const Length2 &v) noexcept |
Use value for the "anchor" (in coordinates local to "body B"). More... | |
constexpr auto & | UseDampingRatio (NonNegative< Real > v) noexcept |
Use value for damping ratio. | |
constexpr auto & | UseFrequency (NonNegative< Frequency > v) noexcept |
Use value for frequency. | |
constexpr auto & | UseMaxForce (NonNegative< Force > v) noexcept |
Use value for max force. | |
constexpr auto & | UseTarget (const Length2 &v) noexcept |
Use value for target. | |
Public Member Functions inherited from playrho::d2::JointBuilder< TargetJointConf > | |
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 | |
LinearVelocity2 | C = {} |
Velocity constant. | |
NonNegative< Real > | dampingRatio = DefaultDampingRatio |
The damping ratio. 0 = no damping, 1 = critical damping. | |
NonNegative< Frequency > | frequency = DefaultFrequency |
InvMass | gamma = InvMass{} |
Gamma. | |
Momentum2 | impulse = Momentum2{} |
Impulse. | |
Length2 | localAnchorB = Length2{} |
Anchor point. | |
Mass22 | mass = {} |
2-by-2 mass matrix in kilograms. | |
NonNegative< Force > | maxForce = DefaultMaxForce |
Length2 | rB = {} |
Relative B. | |
Length2 | target = Length2{} |
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... | |
Static Public Attributes | |
static constexpr auto | DefaultDampingRatio = NonNegativeFF<Real>(static_cast<Real>(0.7f)) |
Default damping ratio. | |
static constexpr auto | DefaultFrequency = NonNegativeFF<Frequency>(5_Hz) |
Default frequency. | |
static constexpr auto | DefaultMaxForce = NonNegativeFF<Force>(0_N) |
Default max force. | |
Related Functions | |
(Note that these are not member functions.) | |
constexpr AngularMomentum | GetAngularReaction (const TargetJointConf &) |
Gets the current angular reaction of the given configuration. | |
Mass22 | GetEffectiveMassMatrix (const TargetJointConf &object, const BodyConstraint &body) noexcept |
Gets the effective mass matrix for the given configuration and body information. | |
constexpr Momentum2 | GetLinearReaction (const TargetJointConf &object) |
Gets the current linear reaction of the given configuration. | |
constexpr auto | GetLocalAnchorA (const TargetJointConf &) noexcept |
Gets the local anchar A for the given configuration. | |
constexpr auto | GetMaxForce (const TargetJointConf &object) noexcept |
Free function for getting the maximum force value of the given configuration. | |
constexpr auto | GetTarget (const TargetJointConf &object) noexcept |
Free function for getting the target value of the given configuration. | |
void | InitVelocity (TargetJointConf &object, const Span< BodyConstraint > &bodies, const StepConf &step, const ConstraintSolverConf &conf) |
Initializes velocity constraint data based on the given solver data. More... | |
constexpr void | SetDampingRatio (TargetJointConf &object, Real value) noexcept |
Free function for setting the damping ratio value of the given configuration. | |
constexpr void | SetFrequency (TargetJointConf &object, NonNegative< Frequency > value) noexcept |
Free function for setting the frequency value of the given configuration. | |
constexpr auto | SetMaxForce (TargetJointConf &object, NonNegative< Force > value) noexcept |
Free function for setting the maximum force value of the given configuration. | |
constexpr void | SetTarget (TargetJointConf &object, const Length2 &value) noexcept |
Free function for setting the target value of the given configuration. | |
constexpr bool | ShiftOrigin (TargetJointConf &object, const Length2 &newOrigin) |
Shifts the origin notion of the given configuration. | |
bool | SolvePosition (const TargetJointConf &object, const Span< BodyConstraint > &bodies, const ConstraintSolverConf &conf) |
Solves the position constraint. More... | |
bool | SolveVelocity (TargetJointConf &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. | |
Target joint definition.
A target joint is used to make a point on a body track a specified world point. This a soft constraint with a maximum force. This allows the constraint to stretch and without applying huge forces.
|
inlineconstexprnoexcept |
Use value for the "anchor" (in coordinates local to "body B").
bodyB != InvalidBodyID ? GetLocalPoint(GetBody(world, bodyB), target) : Length2()
.
|
related |
Initializes velocity constraint data based on the given solver data.
SolveVelocity
. object | Configuration object. bodyB must index a body 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 bodyB value is not InvalidBodyID and does not index within range of the given bodies container. |
|
related |
Solves the position constraint.
true
. true
.
|
related |
Solves velocity constraint.
InitVelocity
has been called. object | Configuration object. bodyB must index a body 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 bodyB value is not InvalidBodyID and does not index within range of the given bodies container. |
true
if velocity is "solved", false
otherwise. NonNegative<Frequency> playrho::d2::TargetJointConf::frequency = DefaultFrequency |
Frequency.
The has to do with the response speed.
Referenced by UseFrequency().
NonNegative<Force> playrho::d2::TargetJointConf::maxForce = DefaultMaxForce |
Max force.
The maximum constraint force that can be exerted to move the candidate body. Usually you will express as some multiple of the weight (multiplier * mass * gravity).
Referenced by UseMaxForce().
The initial world target point. This is assumed to coincide with the body anchor initially.
Referenced by UseTarget().