//
// 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/ConeConstraint.h:69
///
/// class ConeConstraint final : public TwoBodyConstraint
///
///
///
///
/// A cone constraint constraints 2 bodies to a single point and limits the swing between the twist axis within a cone:
///
/// t1 . t2 <= cos(theta)
///
/// Where:
///
/// t1 = twist axis of body 1.
/// t2 = twist axis of body 2.
/// theta = half cone angle (angle from the principal axis of the cone to the edge).
///
/// Calculating the Jacobian:
///
/// Constraint equation:
///
/// C = t1 . t2 - cos(theta)
///
/// Derivative:
///
/// d/dt C = d/dt (t1 . t2) = (d/dt t1) . t2 + t1 . (d/dt t2) = (w1 x t1) . t2 + t1 . (w2 x t2) = (t1 x t2) . w1 + (t2 x t1) . w2
///
/// d/dt C = J v = [0, -t2 x t1, 0, t2 x t1] [v1, w1, v2, w2]
///
/// Where J is the Jacobian.
///
/// Note that this is the exact same equation as used in AngleConstraintPart if we use t2 x t1 as the world space axis
///
///
[InteropHandle]
public readonly partial struct ConeConstraint : IDisposable
{
///
///
/// C++:
/// Jolt/Physics/Constraints/ConeConstraint.h:75
///
/// ConeConstraint(Body &inBody1, Body &inBody2, const ConeConstraintSettings &inSettings)
///
///
///
///
/// Construct cone constraint
///
///
public static ConeConstraint Create(Body body1, Body body2, ConeConstraintSettings settings) => Jolt.PInvoke.ConeConstraint_Create(body1, body2, settings);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConeConstraint.h:78
///
/// virtual EConstraintSubType GetSubType() const override
///
///
///
///
/// Generic interface of a constraint
///
///
public EConstraintSubType GetSubType() => Jolt.PInvoke.ConeConstraint_GetSubType(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConeConstraint.h:79
///
/// virtual void NotifyShapeChanged(const BodyID &inBodyID, Vec3Arg inDeltaCOM) override
///
///
public void NotifyShapeChanged(uint bodyID, float3 deltaCOM) => Jolt.PInvoke.ConeConstraint_NotifyShapeChanged(this, bodyID, deltaCOM);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConeConstraint.h:80
///
/// virtual void SetupVelocityConstraint(float inDeltaTime) override
///
///
public void SetupVelocityConstraint(float deltaTime) => Jolt.PInvoke.ConeConstraint_SetupVelocityConstraint(this, deltaTime);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConeConstraint.h:81
///
/// virtual void ResetWarmStart() override
///
///
public void ResetWarmStart() => Jolt.PInvoke.ConeConstraint_ResetWarmStart(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConeConstraint.h:82
///
/// virtual void WarmStartVelocityConstraint(float inWarmStartImpulseRatio) override
///
///
public void WarmStartVelocityConstraint(float warmStartImpulseRatio) => Jolt.PInvoke.ConeConstraint_WarmStartVelocityConstraint(this, warmStartImpulseRatio);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConeConstraint.h:83
///
/// virtual bool SolveVelocityConstraint(float inDeltaTime) override
///
///
public bool SolveVelocityConstraint(float deltaTime) => Jolt.PInvoke.ConeConstraint_SolveVelocityConstraint(this, deltaTime);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConeConstraint.h:84
///
/// virtual bool SolvePositionConstraint(float inDeltaTime, float inBaumgarte) override
///
///
public bool SolvePositionConstraint(float deltaTime, float baumgarte) => Jolt.PInvoke.ConeConstraint_SolvePositionConstraint(this, deltaTime, baumgarte);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConeConstraint.h:86
///
/// virtual void DrawConstraint(DebugRenderer *inRenderer) const override
///
///
public void DrawConstraint(DebugRenderer renderer) => Jolt.PInvoke.ConeConstraint_DrawConstraint(this, renderer);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConeConstraint.h:87
///
/// virtual void DrawConstraintLimits(DebugRenderer *inRenderer) const override
///
///
public void DrawConstraintLimits(DebugRenderer renderer) => Jolt.PInvoke.ConeConstraint_DrawConstraintLimits(this, renderer);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConeConstraint.h:91
///
/// virtual Ref<ConstraintSettings> GetConstraintSettings() const override
///
///
public ConstraintSettings GetConstraintSettings() => Jolt.PInvoke.ConeConstraint_GetConstraintSettings(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConeConstraint.h:94
///
/// virtual Mat44 GetConstraintToBody1Matrix() const override
///
///
///
///
/// See: TwoBodyConstraint
///
///
public float4x4 GetConstraintToBody1Matrix() => Jolt.PInvoke.ConeConstraint_GetConstraintToBody1Matrix(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConeConstraint.h:95
///
/// virtual Mat44 GetConstraintToBody2Matrix() const override
///
///
public float4x4 GetConstraintToBody2Matrix() => Jolt.PInvoke.ConeConstraint_GetConstraintToBody2Matrix(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConeConstraint.h:98
///
/// void SetHalfConeAngle(float inHalfConeAngle)
///
///
///
///
/// Update maximum angle between body 1 and 2 (see ConeConstraintSettings)
///
///
public void SetHalfConeAngle(float halfConeAngle) => Jolt.PInvoke.ConeConstraint_SetHalfConeAngle(this, halfConeAngle);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConeConstraint.h:99
///
/// float GetCosHalfConeAngle() const
///
///
public float GetCosHalfConeAngle() => Jolt.PInvoke.ConeConstraint_GetCosHalfConeAngle(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConeConstraint.h:102
///
/// 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.ConeConstraint_GetTotalLambdaPosition(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConeConstraint.h:103
///
/// inline float GetTotalLambdaRotation() const
///
///
public float GetTotalLambdaRotation() => Jolt.PInvoke.ConeConstraint_GetTotalLambdaRotation(this);
public void AddRef() => Jolt.PInvoke.ConeConstraint_AddRef(this);
public void Release() => Jolt.PInvoke.ConeConstraint_Release(this);
public uint GetRefCount() => Jolt.PInvoke.ConeConstraint_GetRefCount(this);
public static implicit operator TwoBodyConstraint(ConeConstraint value) => Jolt.PInvoke.ConeConstraint_AsTwoBodyConstraint(value);
public static implicit operator Constraint(ConeConstraint value) => Jolt.PInvoke.ConeConstraint_AsConstraint(value);
public void Dispose()
{
if (IsNull()) return;
Release();
}
}
}