//
// 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 cone constraint constraints 2 bodies to a single point and limits the swing between the twist axis within
/// a cone:
///
///
/// 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
{
///
///
/// Construct cone constraint
///
///
/// C++:
/// Jolt/Physics/Constraints/ConeConstraint.h:75
///
/// ConeConstraint(Body &inBody1, Body &inBody2, const ConeConstraintSettings &inSettings)
///
///
public static ConeConstraint Create(Body body1, Body body2, ConeConstraintSettings settings) =>
Jolt.PInvoke.ConeConstraint_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();
///
///
/// Update maximum angle between body 1 and 2 (see ConeConstraintSettings)
///
///
/// C++:
/// Jolt/Physics/Constraints/ConeConstraint.h:98
///
/// void SetHalfConeAngle(float inHalfConeAngle)
///
///
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() => ((Constraint)this).AddRef();
public void Release() => ((Constraint)this).Release();
public uint GetRefCount() => ((Constraint)this).GetRefCount();
public static implicit operator TwoBodyConstraint(ConeConstraint value) =>
Unsafe.BitCast(value);
public static implicit operator Constraint(ConeConstraint 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);
}
}