//
// 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/ConstraintPart/SwingTwistConstraintPart.h:32
///
/// class SwingTwistConstraintPart
///
///
///
///
/// Quaternion based constraint that decomposes the rotation in constraint space in swing and twist: q = q_swing * q_twist
/// where q_swing.x = 0 and where q_twist.y = q_twist.z = 0
///
/// - Rotation around the twist (x-axis) is within [inTwistMinAngle, inTwistMaxAngle].
/// - Rotation around the swing axis (y and z axis) are limited to an ellipsoid in quaternion space formed by the equation:
///
/// (q_swing.y / sin(inSwingYHalfAngle / 2))^2 + (q_swing.z / sin(inSwingZHalfAngle / 2))^2 <= 1
///
/// Which roughly corresponds to an elliptic cone shape with major axis (inSwingYHalfAngle, inSwingZHalfAngle).
///
/// In case inSwingYHalfAngle = 0, the rotation around Y will be constrained to 0 and the rotation around Z
/// will be constrained between [-inSwingZHalfAngle, inSwingZHalfAngle]. Vice versa if inSwingZHalfAngle = 0.
///
///
[InteropHandle]
public readonly partial struct SwingTwistConstraintPart : IDisposable
{
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h:549
///
/// enum ERotationFlags
///
///
[Flags]
public enum ERotationFlags : int
{
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h:552
///
/// TwistXLocked = 1 << 0
///
///
///
///
/// Indicates that axis is completely locked (cannot rotate around this axis)
///
///
TwistXLocked = 1 << 0,
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h:553
///
/// SwingYLocked = 1 << 1
///
///
SwingYLocked = 1 << 1,
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h:554
///
/// SwingZLocked = 1 << 2
///
///
SwingZLocked = 1 << 2,
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h:557
///
/// TwistXFree = 1 << 3
///
///
///
///
/// Indicates that axis is completely free (can rotate around without limits)
///
///
TwistXFree = 1 << 3,
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h:558
///
/// SwingYFree = 1 << 4
///
///
SwingYFree = 1 << 4,
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h:559
///
/// SwingZFree = 1 << 5
///
///
SwingZFree = 1 << 5,
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h:560
///
/// SwingYZFree = SwingYFree | SwingZFree
///
///
SwingYZFree = SwingYFree | SwingZFree,
}
public static SwingTwistConstraintPart Create() => Jolt.PInvoke.SwingTwistConstraintPart_Create();
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h:36
///
/// void SetSwingType(ESwingType inSwingType)
///
///
///
///
/// Override the swing type
///
///
public void SetSwingType(ESwingType swingType) => Jolt.PInvoke.SwingTwistConstraintPart_SetSwingType(this, swingType);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h:42
///
/// ESwingType GetSwingType() const
///
///
///
///
/// Get the swing type for this part
///
///
public ESwingType GetSwingType() => Jolt.PInvoke.SwingTwistConstraintPart_GetSwingType(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h:48
///
/// void SetLimits(float inTwistMinAngle, float inTwistMaxAngle, float inSwingYMinAngle, float inSwingYMaxAngle, float inSwingZMinAngle, float inSwingZMaxAngle)
///
///
///
///
/// Set limits for this constraint (see description above for parameters)
///
///
public void SetLimits(float twistMinAngle, float twistMaxAngle, float swingYMinAngle, float swingYMaxAngle, float swingZMinAngle, float swingZMaxAngle) => Jolt.PInvoke.SwingTwistConstraintPart_SetLimits(this, twistMinAngle, twistMaxAngle, swingYMinAngle, swingYMaxAngle, swingZMinAngle, swingZMaxAngle);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h:160
///
/// static bool sDistanceToMinShorter(float inDeltaMin, float inDeltaMax)
///
///
///
///
/// Helper function to determine if we're clamped against the min or max limit
///
///
public static bool sDistanceToMinShorter(float deltaMin, float deltaMax) => Jolt.PInvoke.SwingTwistConstraintPart_sDistanceToMinShorter(deltaMin, deltaMax);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h:337
///
/// inline void CalculateConstraintProperties(const Body &inBody1, const Body &inBody2, QuatArg inConstraintRotation, QuatArg inConstraintToWorld)
///
///
///
///
/// Calculate properties used during the functions below
/// @param inBody1 The first body that this constraint is attached to
/// @param inBody2 The second body that this constraint is attached to
/// @param inConstraintRotation The current rotation of the constraint in constraint space
/// @param inConstraintToWorld Rotates from constraint space into world space
///
///
public void CalculateConstraintProperties(Body body1, Body body2, floatQuat constraintRotation, floatQuat constraintToWorld) => Jolt.PInvoke.SwingTwistConstraintPart_CalculateConstraintProperties(this, body1, body2, constraintRotation, constraintToWorld);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h:447
///
/// void Deactivate()
///
///
///
///
/// Deactivate this constraint
///
///
public void Deactivate() => Jolt.PInvoke.SwingTwistConstraintPart_Deactivate(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h:455
///
/// inline bool IsActive() const
///
///
///
///
/// Check if constraint is active
///
///
public bool IsActive() => Jolt.PInvoke.SwingTwistConstraintPart_IsActive(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h:461
///
/// inline void WarmStart(Body &ioBody1, Body &ioBody2, float inWarmStartImpulseRatio)
///
///
///
///
/// Must be called from the WarmStartVelocityConstraint call to apply the previous frame's impulses
///
///
public void WarmStart(Body body1, Body body2, float warmStartImpulseRatio) => Jolt.PInvoke.SwingTwistConstraintPart_WarmStart(this, body1, body2, warmStartImpulseRatio);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h:469
///
/// inline bool SolveVelocityConstraint(Body &ioBody1, Body &ioBody2)
///
///
///
///
/// Iteratively update the velocity constraint. Makes sure d/dt C(...) = 0, where C is the constraint
/// equation.
///
///
public bool SolveVelocityConstraint(Body body1, Body body2) => Jolt.PInvoke.SwingTwistConstraintPart_SolveVelocityConstraint(this, body1, body2);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h:493
///
/// inline bool SolvePositionConstraint(Body &ioBody1, Body &ioBody2, QuatArg inConstraintRotation, QuatArg inConstraintToBody1, QuatArg inConstraintToBody2, float inBaumgarte) const
///
///
///
///
/// Iteratively update the position constraint. Makes sure C(...) = 0.
/// @param ioBody1 The first body that this constraint is attached to
/// @param ioBody2 The second body that this constraint is attached to
/// @param inConstraintRotation The current rotation of the constraint in constraint space
/// @param inConstraintToBody1 , inConstraintToBody2 Rotates from constraint space to body 1/2 space
/// @param inBaumgarte Baumgarte constant (fraction of the error to correct)
///
///
public bool SolvePositionConstraint(Body body1, Body body2, floatQuat constraintRotation, floatQuat constraintToBody1, floatQuat constraintToBody2, float baumgarte) => Jolt.PInvoke.SwingTwistConstraintPart_SolvePositionConstraint(this, body1, body2, constraintRotation, constraintToBody1, constraintToBody2, baumgarte);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h:514
///
/// inline float GetTotalSwingYLambda() const
///
///
///
///
/// Return lagrange multiplier for swing
///
///
public float GetTotalSwingYLambda() => Jolt.PInvoke.SwingTwistConstraintPart_GetTotalSwingYLambda(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h:519
///
/// inline float GetTotalSwingZLambda() const
///
///
public float GetTotalSwingZLambda() => Jolt.PInvoke.SwingTwistConstraintPart_GetTotalSwingZLambda(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SwingTwistConstraintPart.h:525
///
/// inline float GetTotalTwistLambda() const
///
///
///
///
/// Return lagrange multiplier for twist
///
///
public float GetTotalTwistLambda() => Jolt.PInvoke.SwingTwistConstraintPart_GetTotalTwistLambda(this);
public void Dispose() => Jolt.PInvoke.SwingTwistConstraintPart_Destroy(this);
}
}