Jolt Physics
A multi core friendly Game Physics Engine
|
Rack and pinion constraint (slider & gear) settings. More...
#include <RackAndPinionConstraint.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 |
void | SetRatio (int inNumTeethRack, float inRackLength, int inNumTeethPinion) |
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, all properties below should be in the specified space. | |
Vec3 | mHingeAxis = Vec3::sAxisX() |
Body 1 (pinion) constraint reference frame (space determined by mSpace). | |
Vec3 | mSliderAxis = Vec3::sAxisX() |
Body 2 (rack) constraint reference frame (space determined by mSpace) | |
float | mRatio = 1.0f |
Ratio between the rack and pinion, see SetRatio. | |
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. | |
Rack and pinion constraint (slider & gear) settings.
|
overridevirtual |
Create an instance of this constraint. Body1 should be the pinion (gear) and body 2 the rack (slider).
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.
|
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)
inNumTeethRack | Number of teeth that the rack has |
inRackLength | Length of the rack |
inNumTeethPinion | Number of teeth the pinion has |
Vec3 RackAndPinionConstraintSettings::mHingeAxis = Vec3::sAxisX() |
Body 1 (pinion) constraint reference frame (space determined by mSpace).
float RackAndPinionConstraintSettings::mRatio = 1.0f |
Ratio between the rack and pinion, see SetRatio.
Vec3 RackAndPinionConstraintSettings::mSliderAxis = Vec3::sAxisX() |
Body 2 (rack) constraint reference frame (space determined by mSpace)
EConstraintSpace RackAndPinionConstraintSettings::mSpace = EConstraintSpace::WorldSpace |
This determines in which space the constraint is setup, all properties below should be in the specified space.