//
// 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
{
///
///
/// Result of a shape cast test
///
///
/// C++:
/// Jolt/Physics/Collision/ShapeCast.h:116
///
/// class ShapeCastResult : public CollideShapeResult
///
///
[StructLayout(LayoutKind.Explicit, Size = 1136)]
public partial struct ShapeCastResult
{
[FieldOffset(0)]
public float3 ContactPointOn1;
[FieldOffset(16)]
public float3 ContactPointOn2;
[FieldOffset(32)]
public float3 PenetrationAxis;
[FieldOffset(48)]
public float PenetrationDepth;
[FieldOffset(52)]
public uint SubShapeID1;
[FieldOffset(56)]
public uint SubShapeID2;
[FieldOffset(60)]
public uint BodyID2;
[FieldOffset(64)]
public StaticArrayVec3_32 Shape1Face;
[FieldOffset(592)]
public StaticArrayVec3_32 Shape2Face;
///
///
/// This is the fraction where the shape hit the other shape: CenterOfMassOnHit = Start + value * (End -
/// Start)
///
///
/// C++:
/// Jolt/Physics/Collision/ShapeCast.h:172
///
/// float mFraction
///
///
[FieldOffset(1120)]
public float Fraction;
///
///
/// True if the shape was hit from the back side
///
///
/// C++:
/// Jolt/Physics/Collision/ShapeCast.h:173
///
/// bool mIsBackFaceHit
///
///
[FieldOffset(1124)]
public Brutal.Bool8 IsBackFaceHit;
///
///
/// Default constructor
///
///
/// C++:
/// Jolt/Physics/Collision/ShapeCast.h:122
///
/// ShapeCastResult() = default
///
///
public static ShapeCastResult Create() => Jolt.PInvoke.ShapeCastResult_Create();
///
///
/// Constructor
///
///
/// C++:
/// Jolt/Physics/Collision/ShapeCast.h:133
///
/// ShapeCastResult(float inFraction, Vec3Arg inContactPoint1, Vec3Arg inContactPoint2, Vec3Arg inContactNormalOrPenetrationDepth, bool inBackFaceHit, const SubShapeID &inSubShapeID1, const SubShapeID &inSubShapeID2, const BodyID &inBodyID2)
///
///
///
///
/// Constructor
/// @param inFraction Fraction at which the cast hit
/// @param inContactPoint1 Contact point on shape 1
/// @param inContactPoint2 Contact point on shape 2
/// @param inContactNormalOrPenetrationDepth Contact normal pointing from shape 1 to 2 or penetration depth vector when the objects are penetrating (also from 1 to 2)
/// @param inBackFaceHit If this hit was a back face hit
/// @param inSubShapeID1 Sub shape id for shape 1
/// @param inSubShapeID2 Sub shape id for shape 2
/// @param inBodyID2 BodyID that was hit
///
///
public static ShapeCastResult Create(
float fraction,
float3 contactPoint1,
float3 contactPoint2,
float3 contactNormalOrPenetrationDepth,
bool backFaceHit,
uint subShapeID1,
uint subShapeID2,
uint bodyID2
) =>
Jolt.PInvoke.ShapeCastResult_Create_2(
fraction,
contactPoint1,
contactPoint2,
contactNormalOrPenetrationDepth,
backFaceHit,
subShapeID1,
subShapeID2,
bodyID2
);
///
///
/// Function required by the CollisionCollector. A smaller fraction is considered to be a 'better hit'. For
/// rays/cast shapes we can just use the collision fraction. The fraction and penetration depth are combined
/// in such a way that deeper hits at fraction 0 go first.
///
///
/// C++:
/// Jolt/Physics/Collision/ShapeCast.h:141
///
/// inline float GetEarlyOutFraction() const
///
///
public readonly float GetEarlyOutFraction() =>
Jolt.PInvoke.ShapeCastResult_GetEarlyOutFraction(ref Unsafe.AsRef(in this));
///
///
/// Reverses the hit result, swapping contact point 1 with contact point 2 etc.
///
///
/// C++:
/// Jolt/Physics/Collision/ShapeCast.h:145
///
/// ShapeCastResult Reversed(Vec3Arg inWorldSpaceCastDirection) const
///
///
///
///
/// Reverses the hit result, swapping contact point 1 with contact point 2 etc.
/// @param inWorldSpaceCastDirection Direction of the shape cast in world space
///
///
public readonly ShapeCastResult Reversed(float3 worldSpaceCastDirection) =>
Jolt.PInvoke.ShapeCastResult_Reversed(ref Unsafe.AsRef(in this), worldSpaceCastDirection);
}
}