Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
RackAndPinionConstraintSettings Class Referencefinal

Rack and pinion constraint (slider & gear) settings. More...

#include <RackAndPinionConstraint.h>

Inheritance diagram for RackAndPinionConstraintSettings:
TwoBodyConstraintSettings ConstraintSettings SerializableObject RefTarget< ConstraintSettings >

Public Member Functions

virtual void SaveBinaryState (StreamOut &inStream) const override
 Saves the contents of the constraint settings in binary form to inStream. More...
 
virtual TwoBodyConstraintCreate (Body &inBody1, Body &inBody2) const override
 
void SetRatio (int inNumTeethRack, float inRackLength, int inNumTeethPinion)
 
virtual TwoBodyConstraintCreate (Body &inBody1, Body &inBody2) const =0
 
virtual void SaveBinaryState (StreamOut &inStream) const
 Saves the contents of the constraint settings in binary form to inStream. More...
 
- Public Member Functions inherited from SerializableObject
virtual ~SerializableObject ()=default
 Constructor. More...
 
- Public Member Functions inherited from RefTarget< ConstraintSettings >
 RefTarget ()=default
 Constructor. More...
 
 RefTarget (const RefTarget &)
 
 ~RefTarget ()
 assert no one is referencing us More...
 
void SetEmbedded () const
 
RefTargetoperator= (const RefTarget &)
 Assignment operator. More...
 
uint32 GetRefCount () const
 Get current refcount of this object. More...
 
void AddRef () const
 Add or release a reference to this object. More...
 
void Release () const
 

Public Attributes

EConstraintSpace mSpace = EConstraintSpace::WorldSpace
 This determines in which space the constraint is setup, all properties below should be in the specified space. More...
 
Vec3 mHingeAxis = Vec3::sAxisX()
 Body 1 (pinion) constraint reference frame (space determined by mSpace). More...
 
Vec3 mSliderAxis = Vec3::sAxisX()
 Body 2 (rack) constraint reference frame (space determined by mSpace) More...
 
float mRatio = 1.0f
 Ratio between the rack and pinion, see SetRatio. More...
 
- Public Attributes inherited from ConstraintSettings
bool mEnabled = true
 If this constraint is enabled initially. Use Constraint::SetEnabled to toggle after creation. More...
 
int mNumVelocityStepsOverride = 0
 Override for the number of solver velocity iterations to run, the total amount of iterations is the max of PhysicsSettings::mNumVelocitySteps and this for all constraints in the island. More...
 
int mNumPositionStepsOverride = 0
 Override for the number of position velocity iterations to run, the total amount of iterations is the max of PhysicsSettings::mNumPositionSteps and this for all constraints in the island. More...
 
float mDrawConstraintSize = 1.0f
 Size of constraint when drawing it through the debug renderer. More...
 
uint64 mUserData = 0
 User data value (can be used by application) More...
 

Protected Member Functions

virtual void RestoreBinaryState (StreamIn &inStream) override
 This function should not be called directly, it is used by sRestoreFromBinaryState. More...
 
virtual void RestoreBinaryState (StreamIn &inStream)
 This function should not be called directly, it is used by sRestoreFromBinaryState. More...
 

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. More...
 
- Static Public Member Functions inherited from RefTarget< ConstraintSettings >
static int sInternalGetRefCountOffset ()
 INTERNAL HELPER FUNCTION USED BY SERIALIZATION. More...
 
- Protected Attributes inherited from RefTarget< ConstraintSettings >
atomic< uint32mRefCount
 Current reference count. More...
 
- 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. More...
 

Detailed Description

Rack and pinion constraint (slider & gear) settings.

Member Function Documentation

◆ Create()

TwoBodyConstraint * RackAndPinionConstraintSettings::Create ( Body inBody1,
Body inBody2 
) const
overridevirtual

Create an an instance of this constraint. Body1 should be the pinion (gear) and body 2 the rack (slider).

Implements TwoBodyConstraintSettings.

◆ RestoreBinaryState()

void RackAndPinionConstraintSettings::RestoreBinaryState ( StreamIn inStream)
overrideprotectedvirtual

This function should not be called directly, it is used by sRestoreFromBinaryState.

Reimplemented from ConstraintSettings.

◆ SaveBinaryState()

void RackAndPinionConstraintSettings::SaveBinaryState ( StreamOut inStream) const
overridevirtual

Saves the contents of the constraint settings in binary form to inStream.

Reimplemented from ConstraintSettings.

◆ SetRatio()

void RackAndPinionConstraintSettings::SetRatio ( int  inNumTeethRack,
float  inRackLength,
int  inNumTeethPinion 
)
inline

Defines the ratio between the rotation of the pinion and the translation of the rack. The ratio is defined as: PinionRotation(t) = ratio * RackTranslation(t)

Parameters
inNumTeethRackNumber of teeth that the rack has
inRackLengthLength of the rack
inNumTeethPinionNumber of teeth the pinion has

Member Data Documentation

◆ mHingeAxis

Vec3 RackAndPinionConstraintSettings::mHingeAxis = Vec3::sAxisX()

Body 1 (pinion) constraint reference frame (space determined by mSpace).

◆ mRatio

float RackAndPinionConstraintSettings::mRatio = 1.0f

Ratio between the rack and pinion, see SetRatio.

◆ mSliderAxis

Vec3 RackAndPinionConstraintSettings::mSliderAxis = Vec3::sAxisX()

Body 2 (rack) constraint reference frame (space determined by mSpace)

◆ mSpace

EConstraintSpace RackAndPinionConstraintSettings::mSpace = EConstraintSpace::WorldSpace

This determines in which space the constraint is setup, all properties below should be in the specified space.


The documentation for this class was generated from the following files: