57 float mPathFraction = 0.0f;
60 float mMaxFrictionForce = 0.0f;
84 virtual void NotifyShapeChanged(
const BodyID &inBodyID,
Vec3Arg inDeltaCOM)
override;
85 virtual void SetupVelocityConstraint(
float inDeltaTime)
override;
86 virtual void ResetWarmStart()
override;
87 virtual void WarmStartVelocityConstraint(
float inWarmStartImpulseRatio)
override;
88 virtual bool SolveVelocityConstraint(
float inDeltaTime)
override;
89 virtual bool SolvePositionConstraint(
float inDeltaTime,
float inBaumgarte)
override;
90#ifdef JPH_DEBUG_RENDERER
91 virtual void DrawConstraint(
DebugRenderer *inRenderer)
const override;
93 virtual void SaveState(
StateRecorder &inStream)
const override;
124 void SetTargetPathFraction(
float inFraction) {
JPH_ASSERT(mPath->IsLooping() || (inFraction >= 0.0f && inFraction <= mPath->GetPathMaxFraction())); mTargetPathFraction = inFraction; }
136 void CalculateConstraintProperties(
float inDeltaTime);
146 float mMaxFrictionForce;
150 EMotorState mPositionMotorState = EMotorState::Off;
151 float mTargetVelocity = 0.0f;
152 float mTargetPathFraction = 0.0f;
171 Quat mInvInitialOrientation;
174 float mPathFraction = 0.0f;
EConstraintSubType
Enum to identify constraint sub type.
Definition: Constraint.h:34
#define JPH_EXPORT
Definition: Core.h:236
#define JPH_NAMESPACE_END
Definition: Core.h:378
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:372
#define JPH_ASSERT(...)
Definition: IssueReporting.h:33
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition: Memory.h:31
EMotorState
Definition: MotorSettings.h:17
EPathRotationConstraintType
How to constrain the rotation of the body to a PathConstraint.
Definition: PathConstraint.h:19
@ ConstrainToPath
Fully constrain the rotation of body 2 to the path (following the tangent and normal of the path)
@ FullyConstrained
Fully constrain the rotation of the body 2 to the rotation of body 1.
@ Free
Do not constrain the rotation of the body at all.
@ ConstrainAroundNormal
Only allow rotation around the normal vector (perpendicular to the path)
@ ConstrainAroundBinormal
Only allow rotation around the binormal vector (perpendicular to the path)
@ ConstrainAroundTangent
Only allow rotation around the tangent vector (following the path)
#define JPH_DECLARE_SERIALIZABLE_VIRTUAL(linkage, class_name)
Definition: SerializableObject.h:109
Definition: AxisConstraintPart.h:43
ID of a body. This is a way of reasoning about bodies in a multithreaded simulation while avoiding ra...
Definition: BodyID.h:13
virtual void SaveBinaryState(StreamOut &inStream) const
Saves the contents of the constraint settings in binary form to inStream.
Definition: Constraint.cpp:26
virtual void RestoreBinaryState(StreamIn &inStream)
This function should not be called directly, it is used by sRestoreFromBinaryState.
Definition: Constraint.cpp:36
Definition: DebugRenderer.h:47
Definition: DualAxisConstraintPart.h:48
Definition: HingeRotationConstraintPart.h:44
Holds a 4x4 matrix of floats, but supports also operations on the 3x3 upper left part of the matrix.
Definition: Mat44.h:13
Definition: MotorSettings.h:26
Path constraint, used to constrain the degrees of freedom between two bodies to a path.
Definition: PathConstraint.h:75
float GetMaxFrictionForce() const
Definition: PathConstraint.h:113
void SetTargetVelocity(float inVelocity)
Definition: PathConstraint.h:122
void SetTargetPathFraction(float inFraction)
Definition: PathConstraint.h:124
EMotorState GetPositionMotorState() const
Definition: PathConstraint.h:121
float GetTargetPathFraction() const
Definition: PathConstraint.h:125
virtual bool IsActive() const override
Solver interface.
Definition: PathConstraint.h:95
void SetPositionMotorState(EMotorState inState)
Definition: PathConstraint.h:120
virtual EConstraintSubType GetSubType() const override
Get the sub type of a constraint.
Definition: PathConstraint.h:83
Vec3 GetTotalLambdaRotation() const
Definition: PathConstraint.h:132
virtual Mat44 GetConstraintToBody1Matrix() const override
Calculates the transform that transforms from constraint space to body 1 space. The first column of t...
Definition: PathConstraint.h:99
float GetTargetVelocity() const
Definition: PathConstraint.h:123
Vector< 2 > GetTotalLambdaPosition() const
Definition: PathConstraint.h:128
MotorSettings & GetPositionMotorSettings()
Position motor settings.
Definition: PathConstraint.h:116
const PathConstraintPath * GetPath() const
Access to the current path.
Definition: PathConstraint.h:106
Vector< 2 > GetTotalLambdaRotationHinge() const
Definition: PathConstraint.h:131
void SetMaxFrictionForce(float inFrictionForce)
Friction control.
Definition: PathConstraint.h:112
float GetTotalLambdaMotor() const
Definition: PathConstraint.h:130
virtual Mat44 GetConstraintToBody2Matrix() const override
Calculates the transform that transforms from constraint space to body 2 space. The first column of t...
Definition: PathConstraint.h:100
float GetPathFraction() const
Access to the current fraction along the path e [0, GetPath()->GetMaxPathFraction()].
Definition: PathConstraint.h:109
const MotorSettings & GetPositionMotorSettings() const
Definition: PathConstraint.h:117
float GetTotalLambdaPositionLimits() const
Definition: PathConstraint.h:129
The path for a path constraint. It allows attaching two bodies to each other while giving the second ...
Definition: PathConstraintPath.h:21
Definition: PathConstraint.h:37
RefConst< PathConstraintPath > mPath
The path that constrains the two bodies.
Definition: PathConstraint.h:48
MotorSettings mPositionMotorSettings
In case the constraint is powered, this determines the motor settings along the path.
Definition: PathConstraint.h:63
static JPH_INLINE Quat sIdentity()
Definition: Quat.h:103
Definition: Reference.h:151
Definition: Reference.h:101
Definition: RotationEulerConstraintPart.h:36
Definition: StateRecorder.h:48
Simple binary input stream.
Definition: StreamIn.h:13
Simple binary output stream.
Definition: StreamOut.h:13
Base class for all constraints that involve 2 bodies. Body1 is usually considered the parent,...
Definition: TwoBodyConstraint.h:27
virtual bool IsActive() const override
Solver interface.
Definition: TwoBodyConstraint.h:38
Base class for settings for all constraints that involve 2 bodies.
Definition: TwoBodyConstraint.h:16
virtual TwoBodyConstraint * Create(Body &inBody1, Body &inBody2) const =0
static JPH_INLINE Vec3 sZero()
Vector with all zeros.
Definition: Vec3.inl:107
Templatized vector class.
Definition: Vector.h:12