Jolt Physics
A multi core friendly Game Physics Engine
|
#include <PathConstraint.h>
Public Member Functions | |
virtual void | SaveBinaryState (StreamOut &inStream) const override |
Saves the contents of the constraint settings in binary form to inStream. More... | |
virtual TwoBodyConstraint * | Create (Body &inBody1, Body &inBody2) const override |
Create an instance of this constraint. More... | |
virtual TwoBodyConstraint * | Create (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 NonCopyable | |
NonCopyable ()=default | |
NonCopyable (const NonCopyable &)=delete | |
void | operator= (const NonCopyable &)=delete |
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 |
RefTarget & | operator= (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 | |
RefConst< PathConstraintPath > | mPath |
The path that constrains the two bodies. More... | |
Vec3 | mPathPosition = Vec3::sZero() |
The position of the path start relative to world transform of body 1. More... | |
Quat | mPathRotation = Quat::sIdentity() |
The rotation of the path start relative to world transform of body 1. More... | |
float | mPathFraction = 0.0f |
The fraction along the path that corresponds to the initial position of body 2. Usually this is 0, the beginning of the path. But if you want to start an object halfway the path you can calculate this with mPath->GetClosestPoint(point on path to attach body to). More... | |
float | mMaxFrictionForce = 0.0f |
Maximum amount of friction force to apply (N) when not driven by a motor. More... | |
MotorSettings | mPositionMotorSettings |
In case the constraint is powered, this determines the motor settings along the path. More... | |
EPathRotationConstraintType | mRotationConstraintType = EPathRotationConstraintType::Free |
How to constrain the rotation of the body to the path. More... | |
Public Attributes inherited from ConstraintSettings | |
bool | mEnabled = true |
If this constraint is enabled initially. Use Constraint::SetEnabled to toggle after creation. More... | |
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. More... | |
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. 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< uint32 > | mRefCount |
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... | |
Path constraint settings, used to constrain the degrees of freedom between two bodies to a path
The requirements of the path are that:
The reason for all this is that the constraint acts like a slider constraint with the sliding axis being the tangent vector (the assumption here is that delta time will be small enough so that the path is linear for that delta time).
|
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.
float PathConstraintSettings::mMaxFrictionForce = 0.0f |
Maximum amount of friction force to apply (N) when not driven by a motor.
RefConst<PathConstraintPath> PathConstraintSettings::mPath |
The path that constrains the two bodies.
float PathConstraintSettings::mPathFraction = 0.0f |
The fraction along the path that corresponds to the initial position of body 2. Usually this is 0, the beginning of the path. But if you want to start an object halfway the path you can calculate this with mPath->GetClosestPoint(point on path to attach body to).
Vec3 PathConstraintSettings::mPathPosition = Vec3::sZero() |
The position of the path start relative to world transform of body 1.
Quat PathConstraintSettings::mPathRotation = Quat::sIdentity() |
The rotation of the path start relative to world transform of body 1.
MotorSettings PathConstraintSettings::mPositionMotorSettings |
In case the constraint is powered, this determines the motor settings along the path.
EPathRotationConstraintType PathConstraintSettings::mRotationConstraintType = EPathRotationConstraintType::Free |
How to constrain the rotation of the body to the path.