36 float mMinDistance = -1.0f;
37 float mMaxDistance = -1.0f;
58 virtual void NotifyShapeChanged(
const BodyID &inBodyID,
Vec3Arg inDeltaCOM)
override;
59 virtual void SetupVelocityConstraint(
float inDeltaTime)
override;
60 virtual void ResetWarmStart()
override;
61 virtual void WarmStartVelocityConstraint(
float inWarmStartImpulseRatio)
override;
62 virtual bool SolveVelocityConstraint(
float inDeltaTime)
override;
63 virtual bool SolvePositionConstraint(
float inDeltaTime,
float inBaumgarte)
override;
64#ifdef JPH_DEBUG_RENDERER
65 virtual void DrawConstraint(
DebugRenderer *inRenderer)
const override;
67 virtual void SaveState(
StateRecorder &inStream)
const override;
76 void SetDistance(
float inMinDistance,
float inMaxDistance) {
JPH_ASSERT(inMinDistance <= inMaxDistance); mMinDistance = inMinDistance; mMaxDistance = inMaxDistance; }
90 void CalculateConstraintProperties(
float inDeltaTime);
95 Vec3 mLocalSpacePosition1;
96 Vec3 mLocalSpacePosition2;
108 RVec3 mWorldSpacePosition1;
109 RVec3 mWorldSpacePosition2;
110 Vec3 mWorldSpaceNormal;
EConstraintSpace
Certain constraints support setting them up in local or world space. This governs what is used.
Definition: Constraint.h:58
EConstraintSubType
Enum to identify constraint sub type.
Definition: Constraint.h:34
#define JPH_EXPORT
Definition: Core.h:227
#define JPH_NAMESPACE_END
Definition: Core.h:367
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:361
#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(linkage, class_name)
Definition: SerializableObject.h:100
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
This constraint is a stiff spring that holds 2 points at a fixed distance from each other.
Definition: DistanceConstraint.h:49
void SetLimitsSpringSettings(const SpringSettings &inLimitsSpringSettings)
Definition: DistanceConstraint.h:83
const SpringSettings & GetLimitsSpringSettings() const
Update the limits spring settings.
Definition: DistanceConstraint.h:81
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:73
float GetMinDistance() const
Definition: DistanceConstraint.h:77
float GetMaxDistance() const
Definition: DistanceConstraint.h:78
float GetTotalLambdaPosition() const
Definition: DistanceConstraint.h:86
virtual EConstraintSubType GetSubType() const override
Get the sub type of a constraint.
Definition: DistanceConstraint.h:57
void SetDistance(float inMinDistance, float inMaxDistance)
Update the minimum and maximum distance for the constraint.
Definition: DistanceConstraint.h:76
SpringSettings & GetLimitsSpringSettings()
Definition: DistanceConstraint.h:82
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:72
Distance constraint settings, used to create a distance constraint.
Definition: DistanceConstraint.h:14
SpringSettings mLimitsSpringSettings
When enabled, this makes the limits soft. When the constraint exceeds the limits, a spring force will...
Definition: DistanceConstraint.h:40
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
Settings for a linear or angular spring.
Definition: SpringSettings.h:23
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
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