mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 20:48:24 +01:00
285 lines
16 KiB
C#
285 lines
16 KiB
C#
// <auto-generated/>
|
|
// Generated by Brutal.Jolt.Generate; do not edit by hand.
|
|
#nullable enable
|
|
|
|
using System.Runtime.CompilerServices;
|
|
using Brutal.Interop;
|
|
using Brutal.Numerics;
|
|
|
|
namespace Brutal.JoltApi
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// Settings for a linear or angular spring
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/SpringSettings.h#L23">Jolt/Physics/Constraints/SpringSettings.h:23</see>
|
|
/// <br/>
|
|
/// <c>class SpringSettings</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[InteropHandle]
|
|
public readonly partial struct SpringSettings : IDisposable
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// Constructor
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/SpringSettings.h#L29">Jolt/Physics/Constraints/SpringSettings.h:29</see>
|
|
/// <br/>
|
|
/// <c>SpringSettings() = default</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public static SpringSettings Create() => Jolt.PInvoke.SpringSettings_Create();
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/SpringSettings.h#L32">Jolt/Physics/Constraints/SpringSettings.h:32</see>
|
|
/// <br/>
|
|
/// <c>SpringSettings(ESpringMode inMode, float inFrequencyOrStiffness, float inDamping)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public static SpringSettings Create(SpringMode mode, float frequencyOrStiffness, float damping) =>
|
|
Jolt.PInvoke.SpringSettings_Create_2(mode, frequencyOrStiffness, damping);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Saves the contents of the spring settings in binary form to inStream.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/SpringSettings.h#L35">Jolt/Physics/Constraints/SpringSettings.h:35</see>
|
|
/// <br/>
|
|
/// <c>void SaveBinaryState(StreamOut &inStream) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SaveBinaryState(StreamOut stream) => Jolt.PInvoke.SpringSettings_SaveBinaryState(this, stream);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Restores contents from the binary stream inStream.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/SpringSettings.h#L38">Jolt/Physics/Constraints/SpringSettings.h:38</see>
|
|
/// <br/>
|
|
/// <c>void RestoreBinaryState(StreamIn &inStream)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void RestoreBinaryState(StreamIn stream) => Jolt.PInvoke.SpringSettings_RestoreBinaryState(this, stream);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Check if the spring has a valid frequency / stiffness, if not the spring will be hard
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/SpringSettings.h#L41">Jolt/Physics/Constraints/SpringSettings.h:41</see>
|
|
/// <br/>
|
|
/// <c>inline bool HasStiffness() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public bool HasStiffness() => Jolt.PInvoke.SpringSettings_HasStiffness(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Check if this spring has stiffness or damping (making it active), if not the constraint will be hard
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/SpringSettings.h#L44">Jolt/Physics/Constraints/SpringSettings.h:44</see>
|
|
/// <br/>
|
|
/// <c>inline bool HasStiffnessOrDamping() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public bool HasStiffnessOrDamping() => Jolt.PInvoke.SpringSettings_HasStiffnessOrDamping(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Valid when mMode = ESpringMode::FrequencyAndDamping. If > 0 the constraint will be soft and this
|
|
/// specifies the oscillation frequency in Hz. If <= 0, mDamping is ignored and the constraint will have
|
|
/// hard limits (as hard as the time step / the number of velocity / position solver steps allows).
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/SpringSettings.h#L54">Jolt/Physics/Constraints/SpringSettings.h:54</see>
|
|
/// <br/>
|
|
/// <c>float mFrequency = 0.0f</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float GetFrequency() => Jolt.PInvoke.SpringSettings_GetFrequency(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Valid when mMode = ESpringMode::FrequencyAndDamping. If > 0 the constraint will be soft and this
|
|
/// specifies the oscillation frequency in Hz. If <= 0, mDamping is ignored and the constraint will have
|
|
/// hard limits (as hard as the time step / the number of velocity / position solver steps allows).
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/SpringSettings.h#L54">Jolt/Physics/Constraints/SpringSettings.h:54</see>
|
|
/// <br/>
|
|
/// <c>float mFrequency = 0.0f</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetFrequency(float value) => Jolt.PInvoke.SpringSettings_SetFrequency(this, value);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// When mMode = ESpringMode::StiffnessAndDamping: Specifies the stiffness (k) in the spring equation F = -k
|
|
/// * x - c * v for a linear or T = -k * theta - c * w for an angular spring. Units are N / m for a linear
|
|
/// spring and N m / rad for an angular spring.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/SpringSettings.h#L70">Jolt/Physics/Constraints/SpringSettings.h:70</see>
|
|
/// <br/>
|
|
/// <c>float mStiffness</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// When mMode = ESpringMode::StiffnessAndDamping:
|
|
/// Specifies the stiffness (k) in the spring equation F = -k * x - c * v for a linear or T = -k * theta - c * w for an angular spring.
|
|
/// Units are N / m for a linear spring and N m / rad for an angular spring.
|
|
///
|
|
/// Note that stiffness values are large numbers. To calculate a ballpark value for the needed stiffness you can use:
|
|
/// force = stiffness * delta_spring_length = mass * gravity <=> stiffness = mass * gravity / delta_spring_length.
|
|
/// So if your object weighs 1500 kg and the spring compresses by 2 meters, you need a stiffness in the order of 1500 * 9.81 / 2 ~ 7500 N/m.
|
|
///
|
|
/// When mMode = ESpringMode::MassNormalizedStiffnessAndDamping:
|
|
/// Specifies the stiffness (k) in the spring equation F = m_eff * (-k * x - c * v) for a linear or T = i_eff * (-k * theta - c * w) for an angular spring.
|
|
/// m_eff / i_eff is the effective mass / inertia of the constraint.
|
|
/// Units are 1 / s^2 for a linear spring and 1 / rad s^2 for an angular spring.
|
|
///
|
|
/// Since the stiffness is multiplied by the effective mass / inertia of the constraint, you can use much smaller stiffness values and they will be mass independent.
|
|
/// </code>
|
|
/// </remarks>
|
|
public float GetStiffness() => Jolt.PInvoke.SpringSettings_GetStiffness(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// When mMode = ESpringMode::StiffnessAndDamping: Specifies the stiffness (k) in the spring equation F = -k
|
|
/// * x - c * v for a linear or T = -k * theta - c * w for an angular spring. Units are N / m for a linear
|
|
/// spring and N m / rad for an angular spring.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/SpringSettings.h#L70">Jolt/Physics/Constraints/SpringSettings.h:70</see>
|
|
/// <br/>
|
|
/// <c>float mStiffness</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// When mMode = ESpringMode::StiffnessAndDamping:
|
|
/// Specifies the stiffness (k) in the spring equation F = -k * x - c * v for a linear or T = -k * theta - c * w for an angular spring.
|
|
/// Units are N / m for a linear spring and N m / rad for an angular spring.
|
|
///
|
|
/// Note that stiffness values are large numbers. To calculate a ballpark value for the needed stiffness you can use:
|
|
/// force = stiffness * delta_spring_length = mass * gravity <=> stiffness = mass * gravity / delta_spring_length.
|
|
/// So if your object weighs 1500 kg and the spring compresses by 2 meters, you need a stiffness in the order of 1500 * 9.81 / 2 ~ 7500 N/m.
|
|
///
|
|
/// When mMode = ESpringMode::MassNormalizedStiffnessAndDamping:
|
|
/// Specifies the stiffness (k) in the spring equation F = m_eff * (-k * x - c * v) for a linear or T = i_eff * (-k * theta - c * w) for an angular spring.
|
|
/// m_eff / i_eff is the effective mass / inertia of the constraint.
|
|
/// Units are 1 / s^2 for a linear spring and 1 / rad s^2 for an angular spring.
|
|
///
|
|
/// Since the stiffness is multiplied by the effective mass / inertia of the constraint, you can use much smaller stiffness values and they will be mass independent.
|
|
/// </code>
|
|
/// </remarks>
|
|
public void SetStiffness(float value) => Jolt.PInvoke.SpringSettings_SetStiffness(this, value);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Selects the way in which the spring is defined. See the descriptions of the mFrequency, mStiffness and
|
|
/// mDamping properties.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/SpringSettings.h#L47">Jolt/Physics/Constraints/SpringSettings.h:47</see>
|
|
/// <br/>
|
|
/// <c>ESpringMode mMode = ESpringMode::FrequencyAndDamping</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public SpringMode GetMode() => Jolt.PInvoke.SpringSettings_GetMode(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Selects the way in which the spring is defined. See the descriptions of the mFrequency, mStiffness and
|
|
/// mDamping properties.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/SpringSettings.h#L47">Jolt/Physics/Constraints/SpringSettings.h:47</see>
|
|
/// <br/>
|
|
/// <c>ESpringMode mMode = ESpringMode::FrequencyAndDamping</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetMode(SpringMode value) => Jolt.PInvoke.SpringSettings_SetMode(this, value);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// When mMode = ESpringMode::FrequencyAndDamping this is the damping ratio (0 = no damping, 1 = critical
|
|
/// damping).
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/SpringSettings.h#L84">Jolt/Physics/Constraints/SpringSettings.h:84</see>
|
|
/// <br/>
|
|
/// <c>float mDamping = 0.0f</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// When mMode = ESpringMode::FrequencyAndDamping this is the damping ratio (0 = no damping, 1 = critical damping).
|
|
///
|
|
/// When mMode = ESpringMode::StiffnessAndDamping this 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.
|
|
/// Units are N s / m for a linear spring and N s m / rad for an angular spring.
|
|
///
|
|
/// When mMode = ESpringMode::MassNormalizedStiffnessAndDamping this is the damping (c) in the spring equation F = m_eff * (-k * x - c * v) for a linear or T = i_eff * (-k * theta - c * w) for an angular spring.
|
|
/// m_eff / i_eff is the effective mass / inertia of the constraint.
|
|
/// Units are 1 / s for a linear spring and 1 / rad s for an angular spring.
|
|
///
|
|
/// Note that if you set this to 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.
|
|
/// </code>
|
|
/// </remarks>
|
|
public float GetDamping() => Jolt.PInvoke.SpringSettings_GetDamping(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// When mMode = ESpringMode::FrequencyAndDamping this is the damping ratio (0 = no damping, 1 = critical
|
|
/// damping).
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/SpringSettings.h#L84">Jolt/Physics/Constraints/SpringSettings.h:84</see>
|
|
/// <br/>
|
|
/// <c>float mDamping = 0.0f</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// When mMode = ESpringMode::FrequencyAndDamping this is the damping ratio (0 = no damping, 1 = critical damping).
|
|
///
|
|
/// When mMode = ESpringMode::StiffnessAndDamping this 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.
|
|
/// Units are N s / m for a linear spring and N s m / rad for an angular spring.
|
|
///
|
|
/// When mMode = ESpringMode::MassNormalizedStiffnessAndDamping this is the damping (c) in the spring equation F = m_eff * (-k * x - c * v) for a linear or T = i_eff * (-k * theta - c * w) for an angular spring.
|
|
/// m_eff / i_eff is the effective mass / inertia of the constraint.
|
|
/// Units are 1 / s for a linear spring and 1 / rad s for an angular spring.
|
|
///
|
|
/// Note that if you set this to 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.
|
|
/// </code>
|
|
/// </remarks>
|
|
public void SetDamping(float value) => Jolt.PInvoke.SpringSettings_SetDamping(this, value);
|
|
|
|
public void Dispose() => Jolt.PInvoke.SpringSettings_Destroy(this);
|
|
}
|
|
}
|