//
// 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
{
///
///
/// A hinge constraint constrains 2 bodies on a single point and allows only a single axis of rotation
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:65
///
/// class HingeConstraint final : public TwoBodyConstraint
///
///
[InteropHandle]
public readonly partial struct HingeConstraint : IDisposable
{
///
///
/// Construct hinge constraint
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:71
///
/// HingeConstraint(Body &inBody1, Body &inBody2, const HingeConstraintSettings &inSettings)
///
///
public static HingeConstraint Create(Body body1, Body body2, HingeConstraintSettings settings) =>
Jolt.PInvoke.HingeConstraint_Create(body1, body2, settings);
///
public ConstraintSubType GetSubType() => ((Constraint)this).GetSubType();
///
public void NotifyShapeChanged(uint bodyID, float3 deltaCOM) =>
((Constraint)this).NotifyShapeChanged(bodyID, deltaCOM);
///
public void SetupVelocityConstraint(float deltaTime) => ((Constraint)this).SetupVelocityConstraint(deltaTime);
///
public void ResetWarmStart() => ((Constraint)this).ResetWarmStart();
///
public void WarmStartVelocityConstraint(float warmStartImpulseRatio) =>
((Constraint)this).WarmStartVelocityConstraint(warmStartImpulseRatio);
///
public bool SolveVelocityConstraint(float deltaTime) => ((Constraint)this).SolveVelocityConstraint(deltaTime);
///
public bool SolvePositionConstraint(float deltaTime, float baumgarte) =>
((Constraint)this).SolvePositionConstraint(deltaTime, baumgarte);
///
public void DrawConstraint(DebugRenderer renderer) => ((Constraint)this).DrawConstraint(renderer);
///
public void DrawConstraintLimits(DebugRenderer renderer) => ((Constraint)this).DrawConstraintLimits(renderer);
///
public ConstraintSettings GetConstraintSettings() => ((Constraint)this).GetConstraintSettings();
///
public float4x4 GetConstraintToBody1Matrix() => ((TwoBodyConstraint)this).GetConstraintToBody1Matrix();
///
public float4x4 GetConstraintToBody2Matrix() => ((TwoBodyConstraint)this).GetConstraintToBody2Matrix();
///
///
/// Get the attachment point for body 1 relative to body 1 COM (transform by Body::GetCenterOfMassTransform
/// to take to world space)
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:94
///
/// inline Vec3 GetLocalSpacePoint1() const
///
///
public float3 GetLocalSpacePoint1() => Jolt.PInvoke.HingeConstraint_GetLocalSpacePoint1(this);
///
///
/// Get the attachment point for body 2 relative to body 2 COM (transform by Body::GetCenterOfMassTransform
/// to take to world space)
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:97
///
/// inline Vec3 GetLocalSpacePoint2() const
///
///
public float3 GetLocalSpacePoint2() => Jolt.PInvoke.HingeConstraint_GetLocalSpacePoint2(this);
///
///
/// Local space hinge directions (transform direction by Body::GetCenterOfMassTransform to take to world
/// space)
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:100
///
/// Vec3 GetLocalSpaceHingeAxis1() const
///
///
public float3 GetLocalSpaceHingeAxis1() => Jolt.PInvoke.HingeConstraint_GetLocalSpaceHingeAxis1(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:101
///
/// Vec3 GetLocalSpaceHingeAxis2() const
///
///
public float3 GetLocalSpaceHingeAxis2() => Jolt.PInvoke.HingeConstraint_GetLocalSpaceHingeAxis2(this);
///
///
/// Local space normal directions (transform direction by Body::GetCenterOfMassTransform to take to world
/// space)
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:104
///
/// Vec3 GetLocalSpaceNormalAxis1() const
///
///
public float3 GetLocalSpaceNormalAxis1() => Jolt.PInvoke.HingeConstraint_GetLocalSpaceNormalAxis1(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:105
///
/// Vec3 GetLocalSpaceNormalAxis2() const
///
///
public float3 GetLocalSpaceNormalAxis2() => Jolt.PInvoke.HingeConstraint_GetLocalSpaceNormalAxis2(this);
///
///
/// Get the current rotation angle from the rest position
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:108
///
/// float GetCurrentAngle() const
///
///
public float GetCurrentAngle() => Jolt.PInvoke.HingeConstraint_GetCurrentAngle(this);
///
///
/// Friction control
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:111
///
/// void SetMaxFrictionTorque(float inFrictionTorque)
///
///
public void SetMaxFrictionTorque(float frictionTorque) =>
Jolt.PInvoke.HingeConstraint_SetMaxFrictionTorque(this, frictionTorque);
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:112
///
/// float GetMaxFrictionTorque() const
///
///
public float GetMaxFrictionTorque() => Jolt.PInvoke.HingeConstraint_GetMaxFrictionTorque(this);
///
///
/// Motor settings
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:115
///
/// MotorSettings & GetMotorSettings()
///
///
///
///
/// The returned handle is borrowed from its owner; don't Dispose it.
///
///
public MotorSettings GetMotorSettings() => Jolt.PInvoke.HingeConstraint_GetMotorSettings(this);
///
///
/// Motor controls
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:119
///
/// void SetMotorState(EMotorState inState)
///
///
public void SetMotorState(MotorState state) => Jolt.PInvoke.HingeConstraint_SetMotorState(this, state);
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:120
///
/// EMotorState GetMotorState() const
///
///
public MotorState GetMotorState() => Jolt.PInvoke.HingeConstraint_GetMotorState(this);
///
///
/// rad/s
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:121
///
/// void SetTargetAngularVelocity(float inAngularVelocity)
///
///
public void SetTargetAngularVelocity(float angularVelocity) =>
Jolt.PInvoke.HingeConstraint_SetTargetAngularVelocity(this, angularVelocity);
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:122
///
/// float GetTargetAngularVelocity() const
///
///
public float GetTargetAngularVelocity() => Jolt.PInvoke.HingeConstraint_GetTargetAngularVelocity(this);
///
///
/// rad
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:123
///
/// void SetTargetAngle(float inAngle)
///
///
public void SetTargetAngle(float angle) => Jolt.PInvoke.HingeConstraint_SetTargetAngle(this, angle);
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:124
///
/// float GetTargetAngle() const
///
///
public float GetTargetAngle() => Jolt.PInvoke.HingeConstraint_GetTargetAngle(this);
///
///
/// Set the target orientation in body space (R2 = R1 * inOrientation, where R1 and R2 are the world space
/// rotations for body 1 and 2). Calculates the local space target angle and calls SetTargetAngle. Motor
/// state must be EMotorState::Position or EMotorState::PositionAndVelocity for this to have any effect. May
/// set the wrong angle if inOrientation contains large rotations around other axis than the hinge axis.
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:129
///
/// void SetTargetOrientationBS(QuatArg inOrientation)
///
///
public void SetTargetOrientationBS(floatQuat orientation) =>
Jolt.PInvoke.HingeConstraint_SetTargetOrientationBS(this, orientation);
///
///
/// Update the rotation limits of the hinge, value in radians (see HingeConstraintSettings)
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:132
///
/// void SetLimits(float inLimitsMin, float inLimitsMax)
///
///
public void SetLimits(float limitsMin, float limitsMax) =>
Jolt.PInvoke.HingeConstraint_SetLimits(this, limitsMin, limitsMax);
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:133
///
/// float GetLimitsMin() const
///
///
public float GetLimitsMin() => Jolt.PInvoke.HingeConstraint_GetLimitsMin(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:134
///
/// float GetLimitsMax() const
///
///
public float GetLimitsMax() => Jolt.PInvoke.HingeConstraint_GetLimitsMax(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:135
///
/// bool HasLimits() const
///
///
public bool HasLimits() => Jolt.PInvoke.HingeConstraint_HasLimits(this);
///
///
/// Update the limits spring settings
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:138
///
/// const SpringSettings & GetLimitsSpringSettings() const
///
///
///
///
/// The returned handle is borrowed from its owner; don't Dispose it.
///
///
public SpringSettings GetLimitsSpringSettings() => Jolt.PInvoke.HingeConstraint_GetLimitsSpringSettings(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:140
///
/// void SetLimitsSpringSettings(const SpringSettings &inLimitsSpringSettings)
///
///
public void SetLimitsSpringSettings(SpringSettings limitsSpringSettings) =>
Jolt.PInvoke.HingeConstraint_SetLimitsSpringSettings(this, limitsSpringSettings);
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:143
///
/// inline Vec3 GetTotalLambdaPosition() const
///
///
///
///
/// @name Get Lagrange multiplier from last physics update (the linear/angular impulse applied to satisfy
/// the constraint)
///
///
public float3 GetTotalLambdaPosition() => Jolt.PInvoke.HingeConstraint_GetTotalLambdaPosition(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:144
///
/// inline Vector<2> GetTotalLambdaRotation() const
///
///
public float2 GetTotalLambdaRotation() => Jolt.PInvoke.HingeConstraint_GetTotalLambdaRotation(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:145
///
/// inline float GetTotalLambdaRotationLimits() const
///
///
public float GetTotalLambdaRotationLimits() => Jolt.PInvoke.HingeConstraint_GetTotalLambdaRotationLimits(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/HingeConstraint.h:146
///
/// inline float GetTotalLambdaMotor() const
///
///
public float GetTotalLambdaMotor() => Jolt.PInvoke.HingeConstraint_GetTotalLambdaMotor(this);
public void AddRef() => ((Constraint)this).AddRef();
public void Release() => ((Constraint)this).Release();
public uint GetRefCount() => ((Constraint)this).GetRefCount();
public static implicit operator TwoBodyConstraint(HingeConstraint value) =>
Unsafe.BitCast(value);
public static implicit operator Constraint(HingeConstraint value) =>
Unsafe.BitCast(value);
public void Dispose()
{
if (IsNull())
return;
Release();
}
///
public Body GetBody1() => ((TwoBodyConstraint)this).GetBody1();
///
public Body GetBody2() => ((TwoBodyConstraint)this).GetBody2();
///
public ConstraintType GetConstraintType() => ((Constraint)this).GetConstraintType();
///
public uint GetConstraintPriority() => ((Constraint)this).GetConstraintPriority();
///
public void SetConstraintPriority(uint priority) => ((Constraint)this).SetConstraintPriority(priority);
///
public void SetNumVelocityStepsOverride(uint n) => ((Constraint)this).SetNumVelocityStepsOverride(n);
///
public uint GetNumVelocityStepsOverride() => ((Constraint)this).GetNumVelocityStepsOverride();
///
public void SetNumPositionStepsOverride(uint n) => ((Constraint)this).SetNumPositionStepsOverride(n);
///
public uint GetNumPositionStepsOverride() => ((Constraint)this).GetNumPositionStepsOverride();
///
public void SetEnabled(bool enabled) => ((Constraint)this).SetEnabled(enabled);
///
public bool GetEnabled() => ((Constraint)this).GetEnabled();
///
public ulong GetUserData() => ((Constraint)this).GetUserData();
///
public void SetUserData(ulong userData) => ((Constraint)this).SetUserData(userData);
///
public bool IsActive() => ((Constraint)this).IsActive();
///
public void BuildIslands(uint constraintIndex, IslandBuilder builder, BodyManager bodyManager) =>
((Constraint)this).BuildIslands(constraintIndex, builder, bodyManager);
///
public uint BuildIslandSplits(LargeIslandSplitter splitter) => ((Constraint)this).BuildIslandSplits(splitter);
///
public void DrawConstraintReferenceFrame(DebugRenderer renderer) =>
((Constraint)this).DrawConstraintReferenceFrame(renderer);
///
public float GetDrawConstraintSize() => ((Constraint)this).GetDrawConstraintSize();
///
public void SetDrawConstraintSize(float size) => ((Constraint)this).SetDrawConstraintSize(size);
}
}