![]() |
Jolt Physics
A multi core friendly Game Physics Engine
|
Slider constraint settings, used to create a slider constraint. More...
#include <SliderConstraint.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 |
| void | SetSliderAxis (Vec3Arg inSliderAxis) |
| Simple way of setting the slider and normal axis in world space (assumes the bodies are already oriented correctly when the constraint is created) 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 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 | |
| EConstraintSpace | mSpace = EConstraintSpace::WorldSpace |
| This determines in which space the constraint is setup, all properties below should be in the specified space. More... | |
| bool | mAutoDetectPoint = false |
| When mSpace is WorldSpace mPoint1 and mPoint2 can be automatically calculated based on the positions of the bodies when the constraint is created (the current relative position/orientation is chosen as the '0' position). Set this to false if you want to supply the attachment points yourself. More... | |
| RVec3 | mPoint1 = RVec3::sZero() |
| Vec3 | mSliderAxis1 = Vec3::sAxisX() |
| Vec3 | mNormalAxis1 = Vec3::sAxisY() |
| RVec3 | mPoint2 = RVec3::sZero() |
| Body 2 constraint reference frame (space determined by mSpace) More... | |
| Vec3 | mSliderAxis2 = Vec3::sAxisX() |
| Vec3 | mNormalAxis2 = Vec3::sAxisY() |
| float | mLimitsMin = -FLT_MAX |
| When the bodies move so that mPoint1 coincides with mPoint2 the slider position is defined to be 0, movement will be limited between [mLimitsMin, mLimitsMax] where mLimitsMin e [-inf, 0] and mLimitsMax e [0, inf]. More... | |
| float | mLimitsMax = FLT_MAX |
| float | mFrequency = 0.0f |
| float | mDamping = 0.0f |
| float | mMaxFrictionForce = 0.0f |
| Maximum amount of friction force to apply (N) when not driven by a motor. More... | |
| MotorSettings | mMotorSettings |
| In case the constraint is powered, this determines the motor settings around the sliding 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 | |
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... | |
Slider constraint settings, used to create a slider constraint.
|
overridevirtual |
Create an an instance of this constraint. Note that the rotation constraint will be solved from body 1. This means that if body 1 and body 2 have different masses / inertias (kinematic body = infinite mass / inertia), body 1 should be the heaviest body.
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.
| void SliderConstraintSettings::SetSliderAxis | ( | Vec3Arg | inSliderAxis | ) |
Simple way of setting the slider and normal axis in world space (assumes the bodies are already oriented correctly when the constraint is created)
| bool SliderConstraintSettings::mAutoDetectPoint = false |
When mSpace is WorldSpace mPoint1 and mPoint2 can be automatically calculated based on the positions of the bodies when the constraint is created (the current relative position/orientation is chosen as the '0' position). Set this to false if you want to supply the attachment points yourself.
| float SliderConstraintSettings::mDamping = 0.0f |
| float SliderConstraintSettings::mFrequency = 0.0f |
If mFrequency > 0 the constraint limits will be soft and mFrequency specifies the oscillation frequency in Hz and mDamping the damping ratio (0 = no damping, 1 = critical damping). If mFrequency <= 0, mDamping is ignored and the limits will be hard.
| float SliderConstraintSettings::mLimitsMax = FLT_MAX |
| float SliderConstraintSettings::mLimitsMin = -FLT_MAX |
When the bodies move so that mPoint1 coincides with mPoint2 the slider position is defined to be 0, movement will be limited between [mLimitsMin, mLimitsMax] where mLimitsMin e [-inf, 0] and mLimitsMax e [0, inf].
| float SliderConstraintSettings::mMaxFrictionForce = 0.0f |
Maximum amount of friction force to apply (N) when not driven by a motor.
| MotorSettings SliderConstraintSettings::mMotorSettings |
In case the constraint is powered, this determines the motor settings around the sliding axis.
| Vec3 SliderConstraintSettings::mNormalAxis1 = Vec3::sAxisY() |
| Vec3 SliderConstraintSettings::mNormalAxis2 = Vec3::sAxisY() |
| RVec3 SliderConstraintSettings::mPoint1 = RVec3::sZero() |
Body 1 constraint reference frame (space determined by mSpace). Slider axis is the axis along which movement is possible (direction), normal axis is a perpendicular vector to define the frame.
| RVec3 SliderConstraintSettings::mPoint2 = RVec3::sZero() |
Body 2 constraint reference frame (space determined by mSpace)
| Vec3 SliderConstraintSettings::mSliderAxis1 = Vec3::sAxisX() |
| Vec3 SliderConstraintSettings::mSliderAxis2 = Vec3::sAxisX() |
| EConstraintSpace SliderConstraintSettings::mSpace = EConstraintSpace::WorldSpace |
This determines in which space the constraint is setup, all properties below should be in the specified space.