Jolt Physics
A multi core friendly Game Physics Engine

#include <PulleyConstraint.h>
Public Member Functions  
virtual void  SaveBinaryState (StreamOut &inStream) const override 
Saves the contents of the constraint settings in binary form to inStream.  
virtual TwoBodyConstraint *  Create (Body &inBody1, Body &inBody2) const override 
Create an instance of this constraint.  
Public Member Functions inherited from SerializableObject  
virtual  ~SerializableObject ()=default 
Constructor.  
Public Member Functions inherited from NonCopyable  
NonCopyable ()=default  
NonCopyable (const NonCopyable &)=delete  
void  operator= (const NonCopyable &)=delete 
Public Member Functions inherited from RefTarget< ConstraintSettings >  
RefTarget ()=default  
Constructor.  
RefTarget (const RefTarget &)  
~RefTarget ()  
assert no one is referencing us  
void  SetEmbedded () const 
RefTarget &  operator= (const RefTarget &) 
Assignment operator.  
uint32  GetRefCount () const 
Get current refcount of this object.  
void  AddRef () const 
Add or release a reference to this object.  
void  Release () const 
Public Attributes  
EConstraintSpace  mSpace = EConstraintSpace::WorldSpace 
This determines in which space the constraint is setup, specified properties below should be in the specified space.  
RVec3  mBodyPoint1 = RVec3::sZero() 
Body 1 constraint attachment point (space determined by mSpace).  
RVec3  mFixedPoint1 = RVec3::sZero() 
Fixed world point to which body 1 is connected (always world space)  
RVec3  mBodyPoint2 = RVec3::sZero() 
Body 2 constraint attachment point (space determined by mSpace)  
RVec3  mFixedPoint2 = RVec3::sZero() 
Fixed world point to which body 2 is connected (always world space)  
float  mRatio = 1.0f 
Ratio between the two line segments (see formula above), can be used to create a block and tackle.  
float  mMinLength = 0.0f 
The minimum length of the line segments (see formula above), use 1 to calculate the length based on the positions of the objects when the constraint is created.  
float  mMaxLength = 1.0f 
The maximum length of the line segments (see formula above), use 1 to calculate the length based on the positions of the objects when the constraint is created.  
Public Attributes inherited from ConstraintSettings  
bool  mEnabled = true 
If this constraint is enabled initially. Use Constraint::SetEnabled to toggle after creation.  
uint32  mConstraintPriority = 0 
uint  mNumVelocityStepsOverride = 0 
Used only when the constraint is active. Override for the number of solver velocity iterations to run, 0 means use the default in PhysicsSettings::mNumVelocitySteps. The number of iterations to use is the max of all contacts and constraints in the island.  
uint  mNumPositionStepsOverride = 0 
Used only when the constraint is active. Override for the number of solver position iterations to run, 0 means use the default in PhysicsSettings::mNumPositionSteps. The number of iterations to use is the max of all contacts and constraints in the island.  
float  mDrawConstraintSize = 1.0f 
Size of constraint when drawing it through the debug renderer.  
uint64  mUserData = 0 
User data value (can be used by application)  
Protected Member Functions  
virtual void  RestoreBinaryState (StreamIn &inStream) override 
This function should not be called directly, it is used by sRestoreFromBinaryState.  
Additional Inherited Members  
Public Types inherited from ConstraintSettings  
using  ConstraintResult = Result< Ref< ConstraintSettings > > 
Static Public Member Functions inherited from ConstraintSettings  
static ConstraintResult  sRestoreFromBinaryState (StreamIn &inStream) 
Creates a constraint of the correct type and restores its contents from the binary stream inStream.  
Static Public Member Functions inherited from RefTarget< ConstraintSettings >  
static int  sInternalGetRefCountOffset () 
INTERNAL HELPER FUNCTION USED BY SERIALIZATION.  
Protected Attributes inherited from RefTarget< ConstraintSettings >  
atomic< uint32 >  mRefCount 
Current reference count.  
Static Protected Attributes inherited from RefTarget< ConstraintSettings >  
static constexpr uint32  cEmbedded 
A large value that gets added to the refcount to mark the object as embedded.  
Pulley constraint settings, used to create a pulley constraint. A pulley connects two bodies via two fixed world points to each other similar to a distance constraint. We define Length1 = BodyPoint1  FixedPoint1 where Body1 is a point on body 1 in world space and FixedPoint1 a fixed point in world space Length2 = BodyPoint2  FixedPoint2 The constraint keeps the two line segments constrained so that MinDistance <= Length1 + Ratio * Length2 <= MaxDistance

overridevirtual 
Create an instance of this constraint.
Implements TwoBodyConstraintSettings.

overrideprotectedvirtual 
This function should not be called directly, it is used by sRestoreFromBinaryState.
Reimplemented from ConstraintSettings.

overridevirtual 
Saves the contents of the constraint settings in binary form to inStream.
Reimplemented from ConstraintSettings.
RVec3 PulleyConstraintSettings::mBodyPoint1 = RVec3::sZero() 
Body 1 constraint attachment point (space determined by mSpace).
RVec3 PulleyConstraintSettings::mBodyPoint2 = RVec3::sZero() 
Body 2 constraint attachment point (space determined by mSpace)
RVec3 PulleyConstraintSettings::mFixedPoint1 = RVec3::sZero() 
Fixed world point to which body 1 is connected (always world space)
RVec3 PulleyConstraintSettings::mFixedPoint2 = RVec3::sZero() 
Fixed world point to which body 2 is connected (always world space)
float PulleyConstraintSettings::mMaxLength = 1.0f 
The maximum length of the line segments (see formula above), use 1 to calculate the length based on the positions of the objects when the constraint is created.
float PulleyConstraintSettings::mMinLength = 0.0f 
The minimum length of the line segments (see formula above), use 1 to calculate the length based on the positions of the objects when the constraint is created.
float PulleyConstraintSettings::mRatio = 1.0f 
Ratio between the two line segments (see formula above), can be used to create a block and tackle.
EConstraintSpace PulleyConstraintSettings::mSpace = EConstraintSpace::WorldSpace 
This determines in which space the constraint is setup, specified properties below should be in the specified space.