Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
ConstraintSettings Class Reference

Class used to store the configuration of a constraint. Allows run-time creation of constraints. More...

#include <Constraint.h>

Inheritance diagram for ConstraintSettings:
SerializableObject RefTarget< ConstraintSettings > TwoBodyConstraintSettings VehicleConstraintSettings ConeConstraintSettings DistanceConstraintSettings FixedConstraintSettings GearConstraintSettings HingeConstraintSettings PathConstraintSettings PointConstraintSettings PulleyConstraintSettings RackAndPinionConstraintSettings SixDOFConstraintSettings SliderConstraintSettings SwingTwistConstraintSettings

Public Types

using ConstraintResult = Result<Ref<ConstraintSettings>>

Public Member Functions

virtual void SaveBinaryState (StreamOut &inStream) const
 Saves the contents of the constraint settings in binary form to inStream.
Public Member Functions inherited from SerializableObject
virtual ~SerializableObject ()=default
 Destructor.
Public Member Functions inherited from RefTarget< ConstraintSettings >
 RefTarget ()=default
 Constructor.
 ~RefTarget ()
 assert no one is referencing us
void SetEmbedded () const
RefTargetoperator= (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

Static Public Member Functions

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.

Public Attributes

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

 ConstraintSettings ()=default
 Don't allow (copy) constructing this base class, but allow derived classes to (copy) construct themselves.
 ConstraintSettings (const ConstraintSettings &)=default
ConstraintSettingsoperator= (const ConstraintSettings &)=default
virtual void RestoreBinaryState (StreamIn &inStream)
 This function should not be called directly, it is used by sRestoreFromBinaryState.
Protected Member Functions inherited from SerializableObject
 SerializableObject ()=default
 Don't allow (copy) constructing this base class, but allow derived classes to (copy) construct themselves.
 SerializableObject (const SerializableObject &)=default
SerializableObjectoperator= (const SerializableObject &)=default

Additional Inherited Members

Protected Attributes inherited from RefTarget< ConstraintSettings >
atomic< uint32mRefCount
 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.

Detailed Description

Class used to store the configuration of a constraint. Allows run-time creation of constraints.

Member Typedef Documentation

◆ ConstraintResult

Constructor & Destructor Documentation

◆ ConstraintSettings() [1/2]

ConstraintSettings::ConstraintSettings ( )
protecteddefault

Don't allow (copy) constructing this base class, but allow derived classes to (copy) construct themselves.

◆ ConstraintSettings() [2/2]

ConstraintSettings::ConstraintSettings ( const ConstraintSettings & )
protecteddefault

Member Function Documentation

◆ operator=()

ConstraintSettings & ConstraintSettings::operator= ( const ConstraintSettings & )
protecteddefault

◆ RestoreBinaryState()

◆ SaveBinaryState()

◆ sRestoreFromBinaryState()

ConstraintSettings::ConstraintResult ConstraintSettings::sRestoreFromBinaryState ( StreamIn & inStream)
static

Creates a constraint of the correct type and restores its contents from the binary stream inStream.

Member Data Documentation

◆ mConstraintPriority

uint32 ConstraintSettings::mConstraintPriority = 0

Priority of the constraint when solving. Higher numbers are more likely to be solved correctly. Note that if you want a deterministic simulation and you cannot guarantee the order in which constraints are added/removed, you can make the priority for all constraints unique to get a deterministic ordering.

◆ mDrawConstraintSize

float ConstraintSettings::mDrawConstraintSize = 1.0f

Size of constraint when drawing it through the debug renderer.

◆ mEnabled

bool ConstraintSettings::mEnabled = true

If this constraint is enabled initially. Use Constraint::SetEnabled to toggle after creation.

◆ mNumPositionStepsOverride

uint ConstraintSettings::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.

◆ mNumVelocityStepsOverride

uint ConstraintSettings::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.

◆ mUserData

uint64 ConstraintSettings::mUserData = 0

User data value (can be used by application).


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