//
// 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
{
///
///
/// The path for a path constraint. It allows attaching two bodies to each other while giving the second body
/// the freedom to move along a path relative to the first.
///
///
/// C++:
/// Jolt/Physics/Constraints/PathConstraintPath.h:20
///
/// class PathConstraintPath : public SerializableObject, public RefTarget<PathConstraintPath>
///
///
[InteropHandle]
public readonly partial struct PathConstraintPath : IDisposable
{
///
///
/// C++:
/// Jolt/Physics/Constraints/PathConstraintPath.h:22
///
///
///
///
///
///
/// The returned handle is borrowed from its owner; don't Dispose it.
///
///
public RTTI GetRTTI() => Jolt.PInvoke.PathConstraintPath_GetRTTI(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/PathConstraintPath.h:22
///
///
///
///
public unsafe Ptr CastTo(RTTI rtti) => Jolt.PInvoke.PathConstraintPath_CastTo(this, rtti);
///
///
/// Gets the max fraction along the path. I.e. sort of the length of the path.
///
///
/// C++:
/// Jolt/Physics/Constraints/PathConstraintPath.h:31
///
/// virtual float GetPathMaxFraction() const = 0
///
///
public float GetPathMaxFraction() => Jolt.PInvoke.PathConstraintPath_GetPathMaxFraction(this);
///
///
/// Get the globally closest point on the curve (Could be slow!)
///
///
/// C++:
/// Jolt/Physics/Constraints/PathConstraintPath.h:37
///
/// virtual float GetClosestPoint(Vec3Arg inPosition, float inFractionHint) const = 0
///
///
///
///
/// Get the globally closest point on the curve (Could be slow!)
/// @param inPosition Position to find closest point for
/// @param inFractionHint Last known fraction along the path (can be used to speed up the search)
/// @return Fraction of closest point along the path
///
///
public float GetClosestPoint(float3 position, float fractionHint) =>
Jolt.PInvoke.PathConstraintPath_GetClosestPoint(this, position, fractionHint);
///
///
/// Given the fraction along the path, get the point, tangent and normal.
///
///
/// C++:
/// Jolt/Physics/Constraints/PathConstraintPath.h:45
///
/// virtual void GetPointOnPath(float inFraction, Vec3 &outPathPosition, Vec3 &outPathTangent, Vec3 &outPathNormal, Vec3 &outPathBinormal) const = 0
///
///
///
///
/// Given the fraction along the path, get the point, tangent and normal.
/// @param inFraction Fraction along the path [0, GetPathMaxFraction()].
/// @param outPathPosition Returns the closest position to inSearchPosition on the path.
/// @param outPathTangent Returns the tangent to the path at outPathPosition (the vector that follows the direction of the path)
/// @param outPathNormal Return the normal to the path at outPathPosition (a vector that's perpendicular to outPathTangent)
/// @param outPathBinormal Returns the binormal to the path at outPathPosition (a vector so that normal cross tangent = binormal)
///
///
public void GetPointOnPath(
float fraction,
out float3 pathPosition,
out float3 pathTangent,
out float3 pathNormal,
out float3 pathBinormal
) =>
Jolt.PInvoke.PathConstraintPath_GetPointOnPath(
this,
fraction,
out pathPosition,
out pathTangent,
out pathNormal,
out pathBinormal
);
///
///
/// If the path is looping or not. If a path is looping, the first and last point are automatically
/// connected to each other. They should not be the same points.
///
///
/// C++:
/// Jolt/Physics/Constraints/PathConstraintPath.h:48
///
/// void SetIsLooping(bool inIsLooping)
///
///
public void SetIsLooping(bool isLooping) => Jolt.PInvoke.PathConstraintPath_SetIsLooping(this, isLooping);
///
///
/// C++:
/// Jolt/Physics/Constraints/PathConstraintPath.h:49
///
/// bool IsLooping() const
///
///
public bool IsLooping() => Jolt.PInvoke.PathConstraintPath_IsLooping(this);
///
///
/// Draw the path relative to inBaseTransform. Used for debug purposes.
///
///
/// C++:
/// Jolt/Physics/Constraints/PathConstraintPath.h:53
///
/// void DrawPath(DebugRenderer *inRenderer, RMat44Arg inBaseTransform) const
///
///
public void DrawPath(DebugRenderer renderer, in float4x4 baseTransform) =>
Jolt.PInvoke.PathConstraintPath_DrawPath(this, renderer, in baseTransform);
///
///
/// Saves the contents of the path in binary form to inStream.
///
///
/// C++:
/// Jolt/Physics/Constraints/PathConstraintPath.h:57
///
/// virtual void SaveBinaryState(StreamOut &inStream) const
///
///
public void SaveBinaryState(StreamOut stream) => Jolt.PInvoke.PathConstraintPath_SaveBinaryState(this, stream);
///
///
/// Creates a Shape of the correct type and restores its contents from the binary stream inStream.
///
///
/// C++:
/// Jolt/Physics/Constraints/PathConstraintPath.h:60
///
/// static PathResult sRestoreFromBinaryState(StreamIn &inStream)
///
///
///
///
/// Throws JoltException with Jolt's error message when the operation fails.
///
///
public static PathConstraintPath RestoreFromBinaryState(StreamIn stream)
{
var _handle = Jolt.PInvoke.PathConstraintPath_RestoreFromBinaryState(stream);
if (_handle.IsNull())
throw JoltException.FromLastError();
return _handle;
}
public void AddRef() => Jolt.PInvoke.PathConstraintPath_AddRef(this);
public void Release() => Jolt.PInvoke.PathConstraintPath_Release(this);
public uint GetRefCount() => Jolt.PInvoke.PathConstraintPath_GetRefCount(this);
public void Dispose()
{
if (IsNull())
return;
Release();
}
}
}