35 MotorSettings(
float inFrequency,
float inDamping,
float inForceLimit,
float inTorqueLimit) : mSpringSettings(
ESpringMode::
FrequencyAndDamping, inFrequency, inDamping), mMinForceLimit(-inForceLimit), mMaxForceLimit(inForceLimit), mMinTorqueLimit(-inTorqueLimit), mMaxTorqueLimit(inTorqueLimit) {
JPH_ASSERT(IsValid()); }
44 void SetForceLimit(
float inLimit) { mMinForceLimit = -inLimit; mMaxForceLimit = inLimit; }
47 void SetTorqueLimit(
float inLimit) { mMinTorqueLimit = -inLimit; mMaxTorqueLimit = inLimit; }
50 bool IsValid()
const {
return mSpringSettings.mFrequency >= 0.0f && mSpringSettings.mDamping >= 0.0f && mMinForceLimit <= mMaxForceLimit && mMinTorqueLimit <= mMaxTorqueLimit; }
53 void SaveBinaryState(
StreamOut &inStream)
const;
56 void RestoreBinaryState(
StreamIn &inStream);
60 float mMinForceLimit = -FLT_MAX;
61 float mMaxForceLimit = FLT_MAX;
62 float mMinTorqueLimit = -FLT_MAX;
63 float mMaxTorqueLimit = FLT_MAX;
#define JPH_EXPORT
Definition Core.h:271
#define JPH_NAMESPACE_END
Definition Core.h:414
#define JPH_NAMESPACE_BEGIN
Definition Core.h:408
#define JPH_ASSERT(...)
Definition IssueReporting.h:33
EMotorState
Definition MotorSettings.h:17
@ Position
Motor will drive to target position.
@ Velocity
Motor will drive to target velocity.
#define JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(linkage, class_name)
Definition SerializableObject.h:80
ESpringMode
Enum used by constraints to specify how the spring is defined.
Definition SpringSettings.h:16
@ FrequencyAndDamping
Frequency and damping are specified.
Definition MotorSettings.h:26
MotorSettings(float inFrequency, float inDamping, float inForceLimit, float inTorqueLimit)
Definition MotorSettings.h:35
void SetForceLimits(float inMin, float inMax)
Set asymmetric force limits.
Definition MotorSettings.h:38
void SetTorqueLimits(float inMin, float inMax)
Set asymmetric torque limits.
Definition MotorSettings.h:41
MotorSettings(const MotorSettings &)=default
void SetForceLimit(float inLimit)
Set symmetric force limits.
Definition MotorSettings.h:44
MotorSettings(float inFrequency, float inDamping)
Definition MotorSettings.h:34
bool IsValid() const
Check if settings are valid.
Definition MotorSettings.h:50
void SetTorqueLimit(float inLimit)
Set symmetric torque limits.
Definition MotorSettings.h:47
MotorSettings()=default
Constructor.
Settings for a linear or angular spring.
Definition SpringSettings.h:23
Simple binary input stream.
Definition StreamIn.h:13
Simple binary output stream.
Definition StreamOut.h:13