67#ifdef JPH_DEBUG_RENDERER
79 void SetDistance(
float inMinDistance,
float inMaxDistance) {
JPH_ASSERT(inMinDistance <= inMaxDistance); mMinDistance = inMinDistance; mMaxDistance = inMaxDistance; }
96 void CalculateConstraintProperties(
float inDeltaTime);
101 Vec3 mLocalSpacePosition1;
102 Vec3 mLocalSpacePosition2;
115 RVec3 mWorldSpacePosition1;
116 RVec3 mWorldSpacePosition2;
117 Vec3 mWorldSpaceNormal;
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
Definition AxisConstraintPart.h:42
float GetTotalLambda() const
Return lagrange multiplier.
Definition AxisConstraintPart.h:378
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
This constraint is a stiff spring that holds 2 points at a fixed distance from each other.
Definition DistanceConstraint.h:53
float GetDamping() const
Definition DistanceConstraint.h:89
virtual bool SolvePositionConstraint(float inDeltaTime, float inBaumgarte) override
Definition DistanceConstraint.cpp:169
virtual Mat44 GetConstraintToBody2Matrix() const override
Calculates the transform that transforms from constraint space to body 2 space. The first column of t...
Definition DistanceConstraint.h:76
JPH_OVERRIDE_NEW_DELETE DistanceConstraint(Body &inBody1, Body &inBody2, const DistanceConstraintSettings &inSettings)
Construct distance constraint.
Definition DistanceConstraint.cpp:64
float GetFrequency() const
Definition DistanceConstraint.h:85
float GetMinDistance() const
Definition DistanceConstraint.h:80
virtual void WarmStartVelocityConstraint(float inWarmStartImpulseRatio) override
Definition DistanceConstraint.cpp:156
void SetDamping(float inDamping)
Update the spring damping for the constraint.
Definition DistanceConstraint.h:88
float GetMaxDistance() const
Definition DistanceConstraint.h:81
void SetFrequency(float inFrequency)
Update the spring frequency for the constraint.
Definition DistanceConstraint.h:84
virtual void SetupVelocityConstraint(float inDeltaTime) override
Definition DistanceConstraint.cpp:151
virtual void RestoreState(StateRecorder &inStream) override
Restoring state for replay.
Definition DistanceConstraint.cpp:229
virtual void DrawConstraint(DebugRenderer *inRenderer) const override
Definition DistanceConstraint.cpp:192
virtual void SaveState(StateRecorder &inStream) const override
Saving state for replay.
Definition DistanceConstraint.cpp:221
float GetTotalLambdaPosition() const
Definition DistanceConstraint.h:92
virtual void NotifyShapeChanged(const BodyID &inBodyID, Vec3Arg inDeltaCOM) override
Definition DistanceConstraint.cpp:98
virtual EConstraintSubType GetSubType() const override
Get the sub type of a constraint.
Definition DistanceConstraint.h:61
void SetDistance(float inMinDistance, float inMaxDistance)
Update the minimum and maximum distance for the constraint.
Definition DistanceConstraint.h:79
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 DistanceConstraint.cpp:237
virtual Mat44 GetConstraintToBody1Matrix() const override
Calculates the transform that transforms from constraint space to body 1 space. The first column of t...
Definition DistanceConstraint.h:75
virtual bool SolveVelocityConstraint(float inDeltaTime) override
Definition DistanceConstraint.cpp:161
Distance constraint settings, used to create a distance constraint.
Definition DistanceConstraint.h:14
EConstraintSpace mSpace
This determines in which space the constraint is setup, all properties below should be in the specifi...
Definition DistanceConstraint.h:25
RVec3 mPoint2
Body 2 constraint reference frame (space determined by mSpace)
Definition DistanceConstraint.h:33
float mMaxDistance
Definition DistanceConstraint.h:37
virtual void SaveBinaryState(StreamOut &inStream) const override
Saves the contents of the constraint settings in binary form to inStream.
Definition DistanceConstraint.cpp:33
float mMinDistance
Ability to override the distance range at which the two points are kept apart. If the value is negati...
Definition DistanceConstraint.h:36
RVec3 mPoint1
Definition DistanceConstraint.h:30
float mFrequency
Definition DistanceConstraint.h:43
float mDamping
Definition DistanceConstraint.h:44
virtual void RestoreBinaryState(StreamIn &inStream) override
This function should not be called directly, it is used by sRestoreFromBinaryState.
Definition DistanceConstraint.cpp:46
virtual TwoBodyConstraint * Create(Body &inBody1, Body &inBody2) const override
Create an an instance of this constraint.
Definition DistanceConstraint.cpp:59
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
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
static JPH_INLINE Vec3 sZero()
Vector with all zeros.
Definition Vec3.inl:107