// // Generated by Brutal.Jolt.Generate; do not edit by hand. #nullable enable using Brutal.Interop; using Brutal.Numerics; namespace Brutal.JoltApi { /// /// /// C++: /// Jolt/Physics/Constraints/SpringSettings.h:22 ///
/// class SpringSettings ///
///
/// /// /// Settings for a linear or angular spring /// /// [InteropHandle] public readonly partial struct SpringSettings : IDisposable { /// /// /// C++: /// Jolt/Physics/Constraints/SpringSettings.h:28 ///
/// SpringSettings() = default ///
///
/// /// /// Constructor /// /// public static SpringSettings Create() => Jolt.PInvoke.SpringSettings_Create(); /// /// /// C++: /// Jolt/Physics/Constraints/SpringSettings.h:31 ///
/// SpringSettings(ESpringMode inMode, float inFrequencyOrStiffness, float inDamping) ///
///
public static SpringSettings Create(ESpringMode mode, float frequencyOrStiffness, float damping) => Jolt.PInvoke.SpringSettings_Create_2(mode, frequencyOrStiffness, damping); /// /// /// C++: /// Jolt/Physics/Constraints/SpringSettings.h:34 ///
/// void SaveBinaryState(StreamOut &inStream) const ///
///
/// /// /// Saves the contents of the spring settings in binary form to inStream. /// /// public void SaveBinaryState(StreamOut stream) => Jolt.PInvoke.SpringSettings_SaveBinaryState(this, stream); /// /// /// C++: /// Jolt/Physics/Constraints/SpringSettings.h:37 ///
/// void RestoreBinaryState(StreamIn &inStream) ///
///
/// /// /// Restores contents from the binary stream inStream. /// /// public void RestoreBinaryState(StreamIn stream) => Jolt.PInvoke.SpringSettings_RestoreBinaryState(this, stream); /// /// /// C++: /// Jolt/Physics/Constraints/SpringSettings.h:40 ///
/// inline bool HasStiffness() const ///
///
/// /// /// Check if the spring has a valid frequency / stiffness, if not the spring will be hard /// /// public bool HasStiffness() => Jolt.PInvoke.SpringSettings_HasStiffness(this); /// /// /// C++: /// Jolt/Physics/Constraints/SpringSettings.h:44 ///
/// ESpringMode mMode = ESpringMode::FrequencyAndDamping ///
///
/// /// /// Selects the way in which the spring is defined /// If the mode is StiffnessAndDamping then mFrequency becomes the stiffness (k) and mDamping becomes the damping ratio (c) in the spring equation F = -k * x - c * v. Otherwise the properties are as documented. /// /// public ESpringMode GetMode() => Jolt.PInvoke.SpringSettings_GetMode(this); /// /// /// C++: /// Jolt/Physics/Constraints/SpringSettings.h:44 ///
/// ESpringMode mMode = ESpringMode::FrequencyAndDamping ///
///
/// /// /// Selects the way in which the spring is defined /// If the mode is StiffnessAndDamping then mFrequency becomes the stiffness (k) and mDamping becomes the damping ratio (c) in the spring equation F = -k * x - c * v. Otherwise the properties are as documented. /// /// public void SetMode(ESpringMode value) => Jolt.PInvoke.SpringSettings_SetMode(this, value); /// /// /// C++: /// Jolt/Physics/Constraints/SpringSettings.h:67 ///
/// float mDamping = 0.0f ///
///
/// /// /// When mSpringMode = ESpringMode::FrequencyAndDamping mDamping is the damping ratio (0 = no damping, 1 = critical damping). /// When mSpringMode = ESpringMode::StiffnessAndDamping mDamping is the damping (c) in the spring equation F = -k * x - c * v for a linear or T = -k * theta - c * w for an angular spring. /// Note that if you set mDamping = 0, you will not get an infinite oscillation. Because we integrate physics using an explicit Euler scheme, there is always energy loss. /// This is done to keep the simulation from exploding, because with a damping of 0 and even the slightest rounding error, the oscillation could become bigger and bigger until the simulation explodes. /// /// public float GetDamping() => Jolt.PInvoke.SpringSettings_GetDamping(this); /// /// /// C++: /// Jolt/Physics/Constraints/SpringSettings.h:67 ///
/// float mDamping = 0.0f ///
///
/// /// /// When mSpringMode = ESpringMode::FrequencyAndDamping mDamping is the damping ratio (0 = no damping, 1 = critical damping). /// When mSpringMode = ESpringMode::StiffnessAndDamping mDamping is the damping (c) in the spring equation F = -k * x - c * v for a linear or T = -k * theta - c * w for an angular spring. /// Note that if you set mDamping = 0, you will not get an infinite oscillation. Because we integrate physics using an explicit Euler scheme, there is always energy loss. /// This is done to keep the simulation from exploding, because with a damping of 0 and even the slightest rounding error, the oscillation could become bigger and bigger until the simulation explodes. /// /// public void SetDamping(float value) => Jolt.PInvoke.SpringSettings_SetDamping(this, value); public void Dispose() => Jolt.PInvoke.SpringSettings_Destroy(this); } }