mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 20:48:24 +01:00
593 lines
31 KiB
C#
593 lines
31 KiB
C#
// <auto-generated/>
|
|
// 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
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// Dispatch function, main function to handle collisions between shapes
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/CollisionDispatch.h#L18">Jolt/Physics/Collision/CollisionDispatch.h:18</see>
|
|
/// <br/>
|
|
/// <c>class CollisionDispatch</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[InteropHandle]
|
|
public readonly partial struct CollisionDispatch : IDisposable
|
|
{
|
|
public static CollisionDispatch Create() => Jolt.PInvoke.CollisionDispatch_Create();
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Collide 2 shapes and pass any collision on to ioCollector
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/CollisionDispatch.h#L33">Jolt/Physics/Collision/CollisionDispatch.h:33</see>
|
|
/// <br/>
|
|
/// <c>static inline void sCollideShapeVsShape(const Shape *inShape1, const Shape *inShape2, Vec3Arg inScale1, Vec3Arg inScale2, Mat44Arg inCenterOfMassTransform1, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, const CollideShapeSettings &inCollideShapeSettings, CollideShapeCollector &ioCollector, const ShapeFilter &inShapeFilter = { })</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Collide 2 shapes and pass any collision on to ioCollector
|
|
/// @param inShape1 The first shape
|
|
/// @param inShape2 The second shape
|
|
/// @param inScale1 Local space scale of shape 1 (scales relative to its center of mass)
|
|
/// @param inScale2 Local space scale of shape 2 (scales relative to its center of mass)
|
|
/// @param inCenterOfMassTransform1 Transform to transform center of mass of shape 1 into world space
|
|
/// @param inCenterOfMassTransform2 Transform to transform center of mass of shape 2 into world space
|
|
/// @param inSubShapeIDCreator1 Class that tracks the current sub shape ID for shape 1
|
|
/// @param inSubShapeIDCreator2 Class that tracks the current sub shape ID for shape 2
|
|
/// @param inCollideShapeSettings Options for the CollideShape test
|
|
/// @param ioCollector The collector that receives the results.
|
|
/// @param inShapeFilter allows selectively disabling collisions between pairs of (sub) shapes.
|
|
/// </code>
|
|
/// <para>
|
|
/// Collects every hit into collideshapevsshaperesults, which you allocate and size. Returns how many were
|
|
/// written; totalHits is how many the query found, so a larger span is needed when it exceeds the span's
|
|
/// length.
|
|
/// </para>
|
|
/// </remarks>
|
|
public static unsafe uint CollideShapeVsShape(
|
|
Shape shape1,
|
|
Shape shape2,
|
|
float3 scale1,
|
|
float3 scale2,
|
|
in float4x4 centerOfMassTransform1,
|
|
in float4x4 centerOfMassTransform2,
|
|
SubShapeIDCreator subShapeIDCreator1,
|
|
SubShapeIDCreator subShapeIDCreator2,
|
|
CollideShapeSettings collideShapeSettings,
|
|
Span<CollideShapeResult> results,
|
|
out uint totalHits,
|
|
ShapeFilter shapeFilter = default
|
|
)
|
|
{
|
|
fixed (CollideShapeResult* results_fixed = results)
|
|
{
|
|
totalHits = Jolt.PInvoke.CollisionDispatch_CollideShapeVsShape(
|
|
shape1,
|
|
shape2,
|
|
scale1,
|
|
scale2,
|
|
in centerOfMassTransform1,
|
|
in centerOfMassTransform2,
|
|
subShapeIDCreator1,
|
|
subShapeIDCreator2,
|
|
collideShapeSettings,
|
|
results_fixed,
|
|
(uint)results.Length,
|
|
shapeFilter
|
|
);
|
|
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Collide 2 shapes and pass any collision on to ioCollector
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/CollisionDispatch.h#L33">Jolt/Physics/Collision/CollisionDispatch.h:33</see>
|
|
/// <br/>
|
|
/// <c>static inline void sCollideShapeVsShape(const Shape *inShape1, const Shape *inShape2, Vec3Arg inScale1, Vec3Arg inScale2, Mat44Arg inCenterOfMassTransform1, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, const CollideShapeSettings &inCollideShapeSettings, CollideShapeCollector &ioCollector, const ShapeFilter &inShapeFilter = { })</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Collide 2 shapes and pass any collision on to ioCollector
|
|
/// @param inShape1 The first shape
|
|
/// @param inShape2 The second shape
|
|
/// @param inScale1 Local space scale of shape 1 (scales relative to its center of mass)
|
|
/// @param inScale2 Local space scale of shape 2 (scales relative to its center of mass)
|
|
/// @param inCenterOfMassTransform1 Transform to transform center of mass of shape 1 into world space
|
|
/// @param inCenterOfMassTransform2 Transform to transform center of mass of shape 2 into world space
|
|
/// @param inSubShapeIDCreator1 Class that tracks the current sub shape ID for shape 1
|
|
/// @param inSubShapeIDCreator2 Class that tracks the current sub shape ID for shape 2
|
|
/// @param inCollideShapeSettings Options for the CollideShape test
|
|
/// @param ioCollector The collector that receives the results.
|
|
/// @param inShapeFilter allows selectively disabling collisions between pairs of (sub) shapes.
|
|
/// </code>
|
|
/// <para>
|
|
/// Keeps only the closest (or deepest) hit. Returns false, and writes a native default-constructed result
|
|
/// (e.g. RayCastResult's fraction is 1 + epsilon), when nothing was hit.
|
|
/// </para>
|
|
/// </remarks>
|
|
public static bool CollideShapeVsShapeClosest(
|
|
Shape shape1,
|
|
Shape shape2,
|
|
float3 scale1,
|
|
float3 scale2,
|
|
in float4x4 centerOfMassTransform1,
|
|
in float4x4 centerOfMassTransform2,
|
|
SubShapeIDCreator subShapeIDCreator1,
|
|
SubShapeIDCreator subShapeIDCreator2,
|
|
CollideShapeSettings collideShapeSettings,
|
|
out CollideShapeResult result,
|
|
ShapeFilter shapeFilter = default
|
|
) =>
|
|
Jolt.PInvoke.CollisionDispatch_CollideShapeVsShapeClosest(
|
|
shape1,
|
|
shape2,
|
|
scale1,
|
|
scale2,
|
|
in centerOfMassTransform1,
|
|
in centerOfMassTransform2,
|
|
subShapeIDCreator1,
|
|
subShapeIDCreator2,
|
|
collideShapeSettings,
|
|
out result,
|
|
shapeFilter
|
|
) != 0;
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Cast a shape against this shape, passes any hits found to ioCollector. Note: This version takes the
|
|
/// shape cast in local space relative to the center of mass of inShape, take a look at
|
|
/// sCastShapeVsShapeWorldSpace if you have a shape cast in world space.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/CollisionDispatch.h#L53">Jolt/Physics/Collision/CollisionDispatch.h:53</see>
|
|
/// <br/>
|
|
/// <c>static inline void sCastShapeVsShapeLocalSpace(const ShapeCast &inShapeCastLocal, const ShapeCastSettings &inShapeCastSettings, const Shape *inShape, Vec3Arg inScale, const ShapeFilter &inShapeFilter, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, CastShapeCollector &ioCollector)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Cast a shape against this shape, passes any hits found to ioCollector.
|
|
/// Note: This version takes the shape cast in local space relative to the center of mass of inShape, take a look at sCastShapeVsShapeWorldSpace if you have a shape cast in world space.
|
|
/// @param inShapeCastLocal The shape to cast against the other shape and its start and direction.
|
|
/// @param inShapeCastSettings Settings for performing the cast
|
|
/// @param inShape The shape to cast against.
|
|
/// @param inScale Local space scale for the shape to cast against (scales relative to its center of mass).
|
|
/// @param inShapeFilter allows selectively disabling collisions between pairs of (sub) shapes.
|
|
/// @param inCenterOfMassTransform2 Is the center of mass transform of shape 2 (excluding scale), this is used to provide a transform to the shape cast result so that local hit result quantities can be transformed into world space.
|
|
/// @param inSubShapeIDCreator1 Class that tracks the current sub shape ID for the casting shape
|
|
/// @param inSubShapeIDCreator2 Class that tracks the current sub shape ID for the shape we're casting against
|
|
/// @param ioCollector The collector that receives the results.
|
|
/// </code>
|
|
/// <para>
|
|
/// Collects every hit into castshapevsshapelocalspaceresults, which you allocate and size. Returns how many
|
|
/// were written; totalHits is how many the query found, so a larger span is needed when it exceeds the
|
|
/// span's length.
|
|
/// </para>
|
|
/// <para>
|
|
/// Pass default for shapeFilter to filter nothing out.
|
|
/// </para>
|
|
/// </remarks>
|
|
public static unsafe uint CastShapeVsShapeLocalSpace(
|
|
in ShapeCast shapeCastLocal,
|
|
ShapeCastSettings shapeCastSettings,
|
|
Shape shape,
|
|
float3 scale,
|
|
ShapeFilter shapeFilter,
|
|
in float4x4 centerOfMassTransform2,
|
|
SubShapeIDCreator subShapeIDCreator1,
|
|
SubShapeIDCreator subShapeIDCreator2,
|
|
Span<ShapeCastResult> results,
|
|
out uint totalHits
|
|
)
|
|
{
|
|
fixed (ShapeCastResult* results_fixed = results)
|
|
{
|
|
totalHits = Jolt.PInvoke.CollisionDispatch_CastShapeVsShapeLocalSpace(
|
|
in shapeCastLocal,
|
|
shapeCastSettings,
|
|
shape,
|
|
scale,
|
|
shapeFilter,
|
|
in centerOfMassTransform2,
|
|
subShapeIDCreator1,
|
|
subShapeIDCreator2,
|
|
results_fixed,
|
|
(uint)results.Length
|
|
);
|
|
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Cast a shape against this shape, passes any hits found to ioCollector. Note: This version takes the
|
|
/// shape cast in local space relative to the center of mass of inShape, take a look at
|
|
/// sCastShapeVsShapeWorldSpace if you have a shape cast in world space.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/CollisionDispatch.h#L53">Jolt/Physics/Collision/CollisionDispatch.h:53</see>
|
|
/// <br/>
|
|
/// <c>static inline void sCastShapeVsShapeLocalSpace(const ShapeCast &inShapeCastLocal, const ShapeCastSettings &inShapeCastSettings, const Shape *inShape, Vec3Arg inScale, const ShapeFilter &inShapeFilter, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, CastShapeCollector &ioCollector)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Cast a shape against this shape, passes any hits found to ioCollector.
|
|
/// Note: This version takes the shape cast in local space relative to the center of mass of inShape, take a look at sCastShapeVsShapeWorldSpace if you have a shape cast in world space.
|
|
/// @param inShapeCastLocal The shape to cast against the other shape and its start and direction.
|
|
/// @param inShapeCastSettings Settings for performing the cast
|
|
/// @param inShape The shape to cast against.
|
|
/// @param inScale Local space scale for the shape to cast against (scales relative to its center of mass).
|
|
/// @param inShapeFilter allows selectively disabling collisions between pairs of (sub) shapes.
|
|
/// @param inCenterOfMassTransform2 Is the center of mass transform of shape 2 (excluding scale), this is used to provide a transform to the shape cast result so that local hit result quantities can be transformed into world space.
|
|
/// @param inSubShapeIDCreator1 Class that tracks the current sub shape ID for the casting shape
|
|
/// @param inSubShapeIDCreator2 Class that tracks the current sub shape ID for the shape we're casting against
|
|
/// @param ioCollector The collector that receives the results.
|
|
/// </code>
|
|
/// <para>
|
|
/// Keeps only the closest (or deepest) hit. Returns false, and writes a native default-constructed result
|
|
/// (e.g. RayCastResult's fraction is 1 + epsilon), when nothing was hit.
|
|
/// </para>
|
|
/// <para>
|
|
/// Pass default for shapeFilter to filter nothing out.
|
|
/// </para>
|
|
/// </remarks>
|
|
public static bool CastShapeVsShapeLocalSpaceClosest(
|
|
in ShapeCast shapeCastLocal,
|
|
ShapeCastSettings shapeCastSettings,
|
|
Shape shape,
|
|
float3 scale,
|
|
ShapeFilter shapeFilter,
|
|
in float4x4 centerOfMassTransform2,
|
|
SubShapeIDCreator subShapeIDCreator1,
|
|
SubShapeIDCreator subShapeIDCreator2,
|
|
out ShapeCastResult result
|
|
) =>
|
|
Jolt.PInvoke.CollisionDispatch_CastShapeVsShapeLocalSpaceClosest(
|
|
in shapeCastLocal,
|
|
shapeCastSettings,
|
|
shape,
|
|
scale,
|
|
shapeFilter,
|
|
in centerOfMassTransform2,
|
|
subShapeIDCreator1,
|
|
subShapeIDCreator2,
|
|
out result
|
|
) != 0;
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// See: sCastShapeVsShapeLocalSpace. The only difference is that the shape cast (inShapeCastWorld) is
|
|
/// provided in world space. Note: A shape cast contains the center of mass start of the shape, if you have
|
|
/// the world transform of the shape you probably want to construct it using ShapeCast::sFromWorldTransform.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/CollisionDispatch.h#L65">Jolt/Physics/Collision/CollisionDispatch.h:65</see>
|
|
/// <br/>
|
|
/// <c>static inline void sCastShapeVsShapeWorldSpace(const ShapeCast &inShapeCastWorld, const ShapeCastSettings &inShapeCastSettings, const Shape *inShape, Vec3Arg inScale, const ShapeFilter &inShapeFilter, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, CastShapeCollector &ioCollector)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Collects every hit into castshapevsshapeworldspaceresults, which you allocate and size. Returns how many
|
|
/// were written; totalHits is how many the query found, so a larger span is needed when it exceeds the
|
|
/// span's length.
|
|
/// </para>
|
|
/// <para>
|
|
/// Pass default for shapeFilter to filter nothing out.
|
|
/// </para>
|
|
/// </remarks>
|
|
public static unsafe uint CastShapeVsShapeWorldSpace(
|
|
in ShapeCast shapeCastWorld,
|
|
ShapeCastSettings shapeCastSettings,
|
|
Shape shape,
|
|
float3 scale,
|
|
ShapeFilter shapeFilter,
|
|
in float4x4 centerOfMassTransform2,
|
|
SubShapeIDCreator subShapeIDCreator1,
|
|
SubShapeIDCreator subShapeIDCreator2,
|
|
Span<ShapeCastResult> results,
|
|
out uint totalHits
|
|
)
|
|
{
|
|
fixed (ShapeCastResult* results_fixed = results)
|
|
{
|
|
totalHits = Jolt.PInvoke.CollisionDispatch_CastShapeVsShapeWorldSpace(
|
|
in shapeCastWorld,
|
|
shapeCastSettings,
|
|
shape,
|
|
scale,
|
|
shapeFilter,
|
|
in centerOfMassTransform2,
|
|
subShapeIDCreator1,
|
|
subShapeIDCreator2,
|
|
results_fixed,
|
|
(uint)results.Length
|
|
);
|
|
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// See: sCastShapeVsShapeLocalSpace. The only difference is that the shape cast (inShapeCastWorld) is
|
|
/// provided in world space. Note: A shape cast contains the center of mass start of the shape, if you have
|
|
/// the world transform of the shape you probably want to construct it using ShapeCast::sFromWorldTransform.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/CollisionDispatch.h#L65">Jolt/Physics/Collision/CollisionDispatch.h:65</see>
|
|
/// <br/>
|
|
/// <c>static inline void sCastShapeVsShapeWorldSpace(const ShapeCast &inShapeCastWorld, const ShapeCastSettings &inShapeCastSettings, const Shape *inShape, Vec3Arg inScale, const ShapeFilter &inShapeFilter, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, CastShapeCollector &ioCollector)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Keeps only the closest (or deepest) hit. Returns false, and writes a native default-constructed result
|
|
/// (e.g. RayCastResult's fraction is 1 + epsilon), when nothing was hit.
|
|
/// </para>
|
|
/// <para>
|
|
/// Pass default for shapeFilter to filter nothing out.
|
|
/// </para>
|
|
/// </remarks>
|
|
public static bool CastShapeVsShapeWorldSpaceClosest(
|
|
in ShapeCast shapeCastWorld,
|
|
ShapeCastSettings shapeCastSettings,
|
|
Shape shape,
|
|
float3 scale,
|
|
ShapeFilter shapeFilter,
|
|
in float4x4 centerOfMassTransform2,
|
|
SubShapeIDCreator subShapeIDCreator1,
|
|
SubShapeIDCreator subShapeIDCreator2,
|
|
out ShapeCastResult result
|
|
) =>
|
|
Jolt.PInvoke.CollisionDispatch_CastShapeVsShapeWorldSpaceClosest(
|
|
in shapeCastWorld,
|
|
shapeCastSettings,
|
|
shape,
|
|
scale,
|
|
shapeFilter,
|
|
in centerOfMassTransform2,
|
|
subShapeIDCreator1,
|
|
subShapeIDCreator2,
|
|
out result
|
|
) != 0;
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Initialize all collision functions with a function that asserts and returns no collision
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/CollisionDispatch.h#L78">Jolt/Physics/Collision/CollisionDispatch.h:78</see>
|
|
/// <br/>
|
|
/// <c>static void sInit()</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public static void Init() => Jolt.PInvoke.CollisionDispatch_Init();
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// An implementation of CollideShape that swaps inShape1 and inShape2 and swaps the result back, can be
|
|
/// registered if the collision function only exists the other way around
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/CollisionDispatch.h#L87">Jolt/Physics/Collision/CollisionDispatch.h:87</see>
|
|
/// <br/>
|
|
/// <c>static void sReversedCollideShape(const Shape *inShape1, const Shape *inShape2, Vec3Arg inScale1, Vec3Arg inScale2, Mat44Arg inCenterOfMassTransform1, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, const CollideShapeSettings &inCollideShapeSettings, CollideShapeCollector &ioCollector, const ShapeFilter &inShapeFilter)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Collects every hit into reversedcollideshaperesults, which you allocate and size. Returns how many were
|
|
/// written; totalHits is how many the query found, so a larger span is needed when it exceeds the span's
|
|
/// length.
|
|
/// </para>
|
|
/// <para>
|
|
/// Pass default for shapeFilter to filter nothing out.
|
|
/// </para>
|
|
/// </remarks>
|
|
public static unsafe uint ReversedCollideShape(
|
|
Shape shape1,
|
|
Shape shape2,
|
|
float3 scale1,
|
|
float3 scale2,
|
|
in float4x4 centerOfMassTransform1,
|
|
in float4x4 centerOfMassTransform2,
|
|
SubShapeIDCreator subShapeIDCreator1,
|
|
SubShapeIDCreator subShapeIDCreator2,
|
|
CollideShapeSettings collideShapeSettings,
|
|
Span<CollideShapeResult> results,
|
|
out uint totalHits,
|
|
ShapeFilter shapeFilter
|
|
)
|
|
{
|
|
fixed (CollideShapeResult* results_fixed = results)
|
|
{
|
|
totalHits = Jolt.PInvoke.CollisionDispatch_ReversedCollideShape(
|
|
shape1,
|
|
shape2,
|
|
scale1,
|
|
scale2,
|
|
in centerOfMassTransform1,
|
|
in centerOfMassTransform2,
|
|
subShapeIDCreator1,
|
|
subShapeIDCreator2,
|
|
collideShapeSettings,
|
|
results_fixed,
|
|
(uint)results.Length,
|
|
shapeFilter
|
|
);
|
|
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// An implementation of CollideShape that swaps inShape1 and inShape2 and swaps the result back, can be
|
|
/// registered if the collision function only exists the other way around
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/CollisionDispatch.h#L87">Jolt/Physics/Collision/CollisionDispatch.h:87</see>
|
|
/// <br/>
|
|
/// <c>static void sReversedCollideShape(const Shape *inShape1, const Shape *inShape2, Vec3Arg inScale1, Vec3Arg inScale2, Mat44Arg inCenterOfMassTransform1, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, const CollideShapeSettings &inCollideShapeSettings, CollideShapeCollector &ioCollector, const ShapeFilter &inShapeFilter)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Keeps only the closest (or deepest) hit. Returns false, and writes a native default-constructed result
|
|
/// (e.g. RayCastResult's fraction is 1 + epsilon), when nothing was hit.
|
|
/// </para>
|
|
/// <para>
|
|
/// Pass default for shapeFilter to filter nothing out.
|
|
/// </para>
|
|
/// </remarks>
|
|
public static bool ReversedCollideShapeClosest(
|
|
Shape shape1,
|
|
Shape shape2,
|
|
float3 scale1,
|
|
float3 scale2,
|
|
in float4x4 centerOfMassTransform1,
|
|
in float4x4 centerOfMassTransform2,
|
|
SubShapeIDCreator subShapeIDCreator1,
|
|
SubShapeIDCreator subShapeIDCreator2,
|
|
CollideShapeSettings collideShapeSettings,
|
|
out CollideShapeResult result,
|
|
ShapeFilter shapeFilter
|
|
) =>
|
|
Jolt.PInvoke.CollisionDispatch_ReversedCollideShapeClosest(
|
|
shape1,
|
|
shape2,
|
|
scale1,
|
|
scale2,
|
|
in centerOfMassTransform1,
|
|
in centerOfMassTransform2,
|
|
subShapeIDCreator1,
|
|
subShapeIDCreator2,
|
|
collideShapeSettings,
|
|
out result,
|
|
shapeFilter
|
|
) != 0;
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// An implementation of CastShape that swaps inShape1 and inShape2 and swaps the result back, can be
|
|
/// registered if the collision function only exists the other way around
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/CollisionDispatch.h#L90">Jolt/Physics/Collision/CollisionDispatch.h:90</see>
|
|
/// <br/>
|
|
/// <c>static void sReversedCastShape(const ShapeCast &inShapeCast, const ShapeCastSettings &inShapeCastSettings, const Shape *inShape, Vec3Arg inScale, const ShapeFilter &inShapeFilter, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, CastShapeCollector &ioCollector)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Collects every hit into reversedcastshaperesults, which you allocate and size. Returns how many were
|
|
/// written; totalHits is how many the query found, so a larger span is needed when it exceeds the span's
|
|
/// length.
|
|
/// </para>
|
|
/// <para>
|
|
/// Pass default for shapeFilter to filter nothing out.
|
|
/// </para>
|
|
/// </remarks>
|
|
public static unsafe uint ReversedCastShape(
|
|
in ShapeCast shapeCast,
|
|
ShapeCastSettings shapeCastSettings,
|
|
Shape shape,
|
|
float3 scale,
|
|
ShapeFilter shapeFilter,
|
|
in float4x4 centerOfMassTransform2,
|
|
SubShapeIDCreator subShapeIDCreator1,
|
|
SubShapeIDCreator subShapeIDCreator2,
|
|
Span<ShapeCastResult> results,
|
|
out uint totalHits
|
|
)
|
|
{
|
|
fixed (ShapeCastResult* results_fixed = results)
|
|
{
|
|
totalHits = Jolt.PInvoke.CollisionDispatch_ReversedCastShape(
|
|
in shapeCast,
|
|
shapeCastSettings,
|
|
shape,
|
|
scale,
|
|
shapeFilter,
|
|
in centerOfMassTransform2,
|
|
subShapeIDCreator1,
|
|
subShapeIDCreator2,
|
|
results_fixed,
|
|
(uint)results.Length
|
|
);
|
|
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// An implementation of CastShape that swaps inShape1 and inShape2 and swaps the result back, can be
|
|
/// registered if the collision function only exists the other way around
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/CollisionDispatch.h#L90">Jolt/Physics/Collision/CollisionDispatch.h:90</see>
|
|
/// <br/>
|
|
/// <c>static void sReversedCastShape(const ShapeCast &inShapeCast, const ShapeCastSettings &inShapeCastSettings, const Shape *inShape, Vec3Arg inScale, const ShapeFilter &inShapeFilter, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, CastShapeCollector &ioCollector)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Keeps only the closest (or deepest) hit. Returns false, and writes a native default-constructed result
|
|
/// (e.g. RayCastResult's fraction is 1 + epsilon), when nothing was hit.
|
|
/// </para>
|
|
/// <para>
|
|
/// Pass default for shapeFilter to filter nothing out.
|
|
/// </para>
|
|
/// </remarks>
|
|
public static bool ReversedCastShapeClosest(
|
|
in ShapeCast shapeCast,
|
|
ShapeCastSettings shapeCastSettings,
|
|
Shape shape,
|
|
float3 scale,
|
|
ShapeFilter shapeFilter,
|
|
in float4x4 centerOfMassTransform2,
|
|
SubShapeIDCreator subShapeIDCreator1,
|
|
SubShapeIDCreator subShapeIDCreator2,
|
|
out ShapeCastResult result
|
|
) =>
|
|
Jolt.PInvoke.CollisionDispatch_ReversedCastShapeClosest(
|
|
in shapeCast,
|
|
shapeCastSettings,
|
|
shape,
|
|
scale,
|
|
shapeFilter,
|
|
in centerOfMassTransform2,
|
|
subShapeIDCreator1,
|
|
subShapeIDCreator2,
|
|
out result
|
|
) != 0;
|
|
|
|
public void Dispose() => Jolt.PInvoke.CollisionDispatch_Destroy(this);
|
|
}
|
|
}
|