74#ifdef JPH_DEBUG_RENDERER
86 void SetLength(
float inMinLength,
float inMaxLength) {
JPH_ASSERT(inMinLength >= 0.0f && inMinLength <= inMaxLength); mMinLength = inMinLength; mMaxLength = inMaxLength; }
98 float CalculatePositionsNormalsAndLength();
101 void CalculateConstraintProperties();
106 Vec3 mLocalSpacePosition1;
107 Vec3 mLocalSpacePosition2;
110 RVec3 mFixedPosition1;
111 RVec3 mFixedPosition2;
123 RVec3 mWorldSpacePosition1;
124 RVec3 mWorldSpacePosition2;
125 Vec3 mWorldSpaceNormal1;
126 Vec3 mWorldSpaceNormal2;
EConstraintSpace
Certain constraints support setting them up in local or world space. This governs what is used.
Definition Constraint.h:58
@ WorldSpace
All constraint properties are specified in world space.
EConstraintSubType
Enum to identify constraint sub type.
Definition Constraint.h:34
#define JPH_NAMESPACE_END
Definition Core.h:240
#define JPH_NAMESPACE_BEGIN
Definition Core.h:234
#define JPH_ASSERT(...)
Definition IssueReporting.h:33
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition Memory.h:29
#define JPH_DECLARE_SERIALIZABLE_VIRTUAL(class_name)
Definition SerializableObject.h:100
ID of a body. This is a way of reasoning about bodies in a multithreaded simulation while avoiding ra...
Definition BodyID.h:13
Simple triangle renderer for debugging purposes.
Definition DebugRenderer.h:25
Definition IndependentAxisConstraintPart.h:48
float GetTotalLambda() const
Return lagrange multiplier.
Definition IndependentAxisConstraintPart.h:167
Holds a 4x4 matrix of floats, but supports also operations on the 3x3 upper left part of the matrix.
Definition Mat44.h:13
static JPH_INLINE Mat44 sTranslation(Vec3Arg inV)
Get matrix that translates.
Definition Mat44.inl:144
A pulley constraint.
Definition PulleyConstraint.h:60
virtual EConstraintSubType GetSubType() const override
Get the sub type of a constraint.
Definition PulleyConstraint.h:68
virtual void RestoreState(StateRecorder &inStream) override
Restoring state for replay.
Definition PulleyConstraint.cpp:224
float GetCurrentLength() const
Get the current length of both segments (multiplied by the ratio for segment 2)
Definition PulleyConstraint.h:91
void SetLength(float inMinLength, float inMaxLength)
Update the minimum and maximum length for the constraint.
Definition PulleyConstraint.h:86
virtual Ref< ConstraintSettings > GetConstraintSettings() const override
Debug function to convert a constraint to its settings, note that this will not save to which bodies ...
Definition PulleyConstraint.cpp:233
virtual void SetupVelocityConstraint(float inDeltaTime) override
Definition PulleyConstraint.cpp:141
virtual bool SolveVelocityConstraint(float inDeltaTime) override
Definition PulleyConstraint.cpp:164
float GetMinLength() const
Definition PulleyConstraint.h:87
virtual void DrawConstraint(DebugRenderer *inRenderer) const override
Definition PulleyConstraint.cpp:195
virtual bool SolvePositionConstraint(float inDeltaTime, float inBaumgarte) override
Definition PulleyConstraint.cpp:172
virtual Mat44 GetConstraintToBody1Matrix() const override
Calculates the transform that transforms from constraint space to body 1 space. The first column of t...
Definition PulleyConstraint.h:82
virtual Mat44 GetConstraintToBody2Matrix() const override
Calculates the transform that transforms from constraint space to body 2 space. The first column of t...
Definition PulleyConstraint.h:83
float GetMaxLength() const
Definition PulleyConstraint.h:88
virtual void NotifyShapeChanged(const BodyID &inBodyID, Vec3Arg inDeltaCOM) override
Definition PulleyConstraint.cpp:103
virtual void SaveState(StateRecorder &inStream) const override
Saving state for replay.
Definition PulleyConstraint.cpp:215
JPH_OVERRIDE_NEW_DELETE PulleyConstraint(Body &inBody1, Body &inBody2, const PulleyConstraintSettings &inSettings)
Construct distance constraint.
Definition PulleyConstraint.cpp:67
float GetTotalLambdaPosition() const
Definition PulleyConstraint.h:94
virtual void WarmStartVelocityConstraint(float inWarmStartImpulseRatio) override
Definition PulleyConstraint.cpp:159
Definition PulleyConstraint.h:19
RVec3 mFixedPoint2
Fixed world point to which body 2 is connected (always world space)
Definition PulleyConstraint.h:42
virtual void RestoreBinaryState(StreamIn &inStream) override
This function should not be called directly, it is used by sRestoreFromBinaryState.
Definition PulleyConstraint.cpp:48
float mRatio
Ratio between the two line segments (see formula above), can be used to create a block and tackle.
Definition PulleyConstraint.h:45
RVec3 mFixedPoint1
Fixed world point to which body 1 is connected (always world space)
Definition PulleyConstraint.h:36
float mMaxLength
The maximum length of the line segments (see formula above), use -1 to calculate the length based on ...
Definition PulleyConstraint.h:51
virtual TwoBodyConstraint * Create(Body &inBody1, Body &inBody2) const override
Create an an instance of this constraint.
Definition PulleyConstraint.cpp:62
RVec3 mBodyPoint2
Body 2 constraint attachment point (space determined by mSpace)
Definition PulleyConstraint.h:39
EConstraintSpace mSpace
This determines in which space the constraint is setup, specified properties below should be in the s...
Definition PulleyConstraint.h:30
virtual void SaveBinaryState(StreamOut &inStream) const override
Saves the contents of the constraint settings in binary form to inStream.
Definition PulleyConstraint.cpp:34
RVec3 mBodyPoint1
Body 1 constraint attachment point (space determined by mSpace).
Definition PulleyConstraint.h:33
float mMinLength
The minimum length of the line segments (see formula above), use -1 to calculate the length based on ...
Definition PulleyConstraint.h:48
Definition Reference.h:101
Definition StateRecorder.h:15
Simple binary input stream.
Definition StreamIn.h:11
Simple binary output stream.
Definition StreamOut.h:11
Base class for all constraints that involve 2 bodies. Body1 is usually considered the parent,...
Definition TwoBodyConstraint.h:27
Base class for settings for all constraints that involve 2 bodies.
Definition TwoBodyConstraint.h:16
JPH_INLINE float Length() const
Length of vector.
Definition Vec3.inl:669
static JPH_INLINE Vec3 sZero()
Vector with all zeros.
Definition Vec3.inl:107