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

6 Degree Of Freedom Constraint setup structure. Allows control over each of the 6 degrees of freedom. More...

#include <SixDOFConstraint.h>

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

Public Types

enum  EAxis {
  TranslationX , TranslationY , TranslationZ , RotationX ,
  RotationY , RotationZ , Num
}
 Constraint is split up into translation/rotation around X, Y and Z axis. More...
 
- Public Types inherited from ConstraintSettings
using ConstraintResult = Result< Ref< 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
 Create an an instance of this constraint. More...
 
void MakeFreeAxis (EAxis inAxis)
 Make axis free (unconstrained) More...
 
bool IsFreeAxis (EAxis inAxis) const
 
void MakeFixedAxis (EAxis inAxis)
 Make axis fixed (fixed at value 0) More...
 
bool IsFixedAxis (EAxis inAxis) const
 
void SetLimitedAxis (EAxis inAxis, float inMin, float inMax)
 Set a valid range for the constraint. More...
 
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...
 
RVec3 mPosition1 = RVec3::sZero()
 Body 1 constraint reference frame (space determined by mSpace) More...
 
Vec3 mAxisX1 = Vec3::sAxisX()
 
Vec3 mAxisY1 = Vec3::sAxisY()
 
RVec3 mPosition2 = RVec3::sZero()
 Body 2 constraint reference frame (space determined by mSpace) More...
 
Vec3 mAxisX2 = Vec3::sAxisX()
 
Vec3 mAxisY2 = Vec3::sAxisY()
 
float mMaxFriction [EAxis::Num] = { 0, 0, 0, 0, 0, 0 }
 
float mLimitMin [EAxis::Num] = { -FLT_MAX, -FLT_MAX, -FLT_MAX, -FLT_MAX, -FLT_MAX, -FLT_MAX }
 
float mLimitMax [EAxis::Num] = { FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX }
 
MotorSettings mMotorSettings [EAxis::Num]
 Motor settings for each axis. 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

- 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

6 Degree Of Freedom Constraint setup structure. Allows control over each of the 6 degrees of freedom.

Member Enumeration Documentation

◆ EAxis

Constraint is split up into translation/rotation around X, Y and Z axis.

Enumerator
TranslationX 
TranslationY 
TranslationZ 
RotationX 

When limited: MinLimit needs to be [-PI, 0], MaxLimit needs to be [0, PI].

RotationY 

When limited: MaxLimit between [0, PI]. MinLimit = -MaxLimit. Forms a cone shaped limit with Z.

RotationZ 

When limited: MaxLimit between [0, PI]. MinLimit = -MaxLimit. Forms a cone shaped limit with Y.

Num 

Member Function Documentation

◆ Create()

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

Create an an instance of this constraint.

Implements TwoBodyConstraintSettings.

◆ IsFixedAxis()

bool SixDOFConstraintSettings::IsFixedAxis ( EAxis  inAxis) const
inline

◆ IsFreeAxis()

bool SixDOFConstraintSettings::IsFreeAxis ( EAxis  inAxis) const
inline

◆ MakeFixedAxis()

void SixDOFConstraintSettings::MakeFixedAxis ( EAxis  inAxis)
inline

Make axis fixed (fixed at value 0)

◆ MakeFreeAxis()

void SixDOFConstraintSettings::MakeFreeAxis ( EAxis  inAxis)
inline

Make axis free (unconstrained)

◆ RestoreBinaryState()

void SixDOFConstraintSettings::RestoreBinaryState ( StreamIn inStream)
overrideprotectedvirtual

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

Reimplemented from ConstraintSettings.

◆ SaveBinaryState()

void SixDOFConstraintSettings::SaveBinaryState ( StreamOut inStream) const
overridevirtual

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

Reimplemented from ConstraintSettings.

◆ SetLimitedAxis()

void SixDOFConstraintSettings::SetLimitedAxis ( EAxis  inAxis,
float  inMin,
float  inMax 
)
inline

Set a valid range for the constraint.

Member Data Documentation

◆ mAxisX1

Vec3 SixDOFConstraintSettings::mAxisX1 = Vec3::sAxisX()

◆ mAxisX2

Vec3 SixDOFConstraintSettings::mAxisX2 = Vec3::sAxisX()

◆ mAxisY1

Vec3 SixDOFConstraintSettings::mAxisY1 = Vec3::sAxisY()

◆ mAxisY2

Vec3 SixDOFConstraintSettings::mAxisY2 = Vec3::sAxisY()

◆ mLimitMax

float SixDOFConstraintSettings::mLimitMax[EAxis::Num] = { FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX }

◆ mLimitMin

float SixDOFConstraintSettings::mLimitMin[EAxis::Num] = { -FLT_MAX, -FLT_MAX, -FLT_MAX, -FLT_MAX, -FLT_MAX, -FLT_MAX }

Limits. For translation: Min and max linear limits in m (0 is frame of body 1 and 2 coincide). For rotation: Min and max angular limits in rad (0 is frame of body 1 and 2 coincide). See comments at Axis enum for limit ranges.

Remove degree of freedom by setting min = FLT_MAX and max = -FLT_MAX. The constraint will be driven to 0 for this axis.

Free movement over an axis is allowed when min = -FLT_MAX and max = FLT_MAX.

◆ mMaxFriction

float SixDOFConstraintSettings::mMaxFriction[EAxis::Num] = { 0, 0, 0, 0, 0, 0 }

Friction settings. For translation: Max friction force in N. 0 = no friction. For rotation: Max friction torque in Nm. 0 = no friction.

◆ mMotorSettings

MotorSettings SixDOFConstraintSettings::mMotorSettings[EAxis::Num]

Motor settings for each axis.

◆ mPosition1

RVec3 SixDOFConstraintSettings::mPosition1 = RVec3::sZero()

Body 1 constraint reference frame (space determined by mSpace)

◆ mPosition2

RVec3 SixDOFConstraintSettings::mPosition2 = RVec3::sZero()

Body 2 constraint reference frame (space determined by mSpace)

◆ mSpace

EConstraintSpace SixDOFConstraintSettings::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: