//
// 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
{
///
///
/// Interface to the broadphase that can perform collision queries. These queries will only test the bounding
/// box of the body to quickly determine a potential set of colliding bodies. The shapes of the bodies are not
/// tested, if you want this then you should use the NarrowPhaseQuery interface.
///
///
/// C++:
/// Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h:28
///
/// class BroadPhaseQuery : public NonCopyable
///
///
[InteropHandle]
public readonly partial struct BroadPhaseQuery
{
///
///
/// Cast a ray and add any hits to ioCollector
///
///
/// C++:
/// Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h:35
///
/// virtual void CastRay(const RayCast &inRay, RayCastBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter = { }, const ObjectLayerFilter &inObjectLayerFilter = { }) const = 0
///
///
///
///
/// Collects every hit into castrayresults, 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.
///
///
public unsafe uint CastRay(
in RayCast ray,
Span results,
out uint totalHits,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
)
{
fixed (BroadPhaseCastResult* results_fixed = results)
{
totalHits = Jolt.PInvoke.BroadPhaseQuery_CastRay(
this,
in ray,
results_fixed,
(uint)results.Length,
broadPhaseLayerFilter,
objectLayerFilter
);
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
}
}
///
///
/// Cast a ray and add any hits to ioCollector
///
///
/// C++:
/// Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h:35
///
/// virtual void CastRay(const RayCast &inRay, RayCastBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter = { }, const ObjectLayerFilter &inObjectLayerFilter = { }) const = 0
///
///
///
///
/// 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.
///
///
public bool CastRayClosest(
in RayCast ray,
out BroadPhaseCastResult result,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
) =>
Jolt.PInvoke.BroadPhaseQuery_CastRayClosest(
this,
in ray,
out result,
broadPhaseLayerFilter,
objectLayerFilter
) != 0;
///
///
/// Get bodies intersecting with inBox and any hits to ioCollector
///
///
/// C++:
/// Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h:38
///
/// virtual void CollideAABox(const AABox &inBox, CollideShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter = { }, const ObjectLayerFilter &inObjectLayerFilter = { }) const = 0
///
///
///
///
/// Collects every hit into collideaaboxresults, 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.
///
///
public unsafe uint CollideAABox(
in AABox box,
Span results,
out uint totalHits,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
)
{
fixed (uint* results_fixed = results)
{
totalHits = Jolt.PInvoke.BroadPhaseQuery_CollideAABox(
this,
in box,
results_fixed,
(uint)results.Length,
broadPhaseLayerFilter,
objectLayerFilter
);
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
}
}
///
///
/// Get bodies intersecting with a sphere and any hits to ioCollector
///
///
/// C++:
/// Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h:41
///
/// virtual void CollideSphere(Vec3Arg inCenter, float inRadius, CollideShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter = { }, const ObjectLayerFilter &inObjectLayerFilter = { }) const = 0
///
///
///
///
/// Collects every hit into collidesphereresults, 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.
///
///
public unsafe uint CollideSphere(
float3 center,
float radius,
Span results,
out uint totalHits,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
)
{
fixed (uint* results_fixed = results)
{
totalHits = Jolt.PInvoke.BroadPhaseQuery_CollideSphere(
this,
center,
radius,
results_fixed,
(uint)results.Length,
broadPhaseLayerFilter,
objectLayerFilter
);
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
}
}
///
///
/// Get bodies intersecting with a point and any hits to ioCollector
///
///
/// C++:
/// Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h:44
///
/// virtual void CollidePoint(Vec3Arg inPoint, CollideShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter = { }, const ObjectLayerFilter &inObjectLayerFilter = { }) const = 0
///
///
///
///
/// Collects every hit into collidepointresults, 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.
///
///
public unsafe uint CollidePoint(
float3 point,
Span results,
out uint totalHits,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
)
{
fixed (uint* results_fixed = results)
{
totalHits = Jolt.PInvoke.BroadPhaseQuery_CollidePoint(
this,
point,
results_fixed,
(uint)results.Length,
broadPhaseLayerFilter,
objectLayerFilter
);
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
}
}
///
///
/// Get bodies intersecting with an oriented box and any hits to ioCollector
///
///
/// C++:
/// Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h:47
///
/// virtual void CollideOrientedBox(const OrientedBox &inBox, CollideShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter = { }, const ObjectLayerFilter &inObjectLayerFilter = { }) const = 0
///
///
///
///
/// Collects every hit into collideorientedboxresults, 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.
///
///
public unsafe uint CollideOrientedBox(
OrientedBox box,
Span results,
out uint totalHits,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
)
{
fixed (uint* results_fixed = results)
{
totalHits = Jolt.PInvoke.BroadPhaseQuery_CollideOrientedBox(
this,
box,
results_fixed,
(uint)results.Length,
broadPhaseLayerFilter,
objectLayerFilter
);
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
}
}
///
///
/// Cast a box and add any hits to ioCollector
///
///
/// C++:
/// Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h:50
///
/// virtual void CastAABox(const AABoxCast &inBox, CastShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter = { }, const ObjectLayerFilter &inObjectLayerFilter = { }) const = 0
///
///
///
///
/// Collects every hit into castaaboxresults, 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.
///
///
public unsafe uint CastAABox(
in AABoxCast box,
Span results,
out uint totalHits,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
)
{
fixed (BroadPhaseCastResult* results_fixed = results)
{
totalHits = Jolt.PInvoke.BroadPhaseQuery_CastAABox(
this,
in box,
results_fixed,
(uint)results.Length,
broadPhaseLayerFilter,
objectLayerFilter
);
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
}
}
///
///
/// Cast a box and add any hits to ioCollector
///
///
/// C++:
/// Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h:50
///
/// virtual void CastAABox(const AABoxCast &inBox, CastShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter = { }, const ObjectLayerFilter &inObjectLayerFilter = { }) const = 0
///
///
///
///
/// 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.
///
///
public bool CastAABoxClosest(
in AABoxCast box,
out BroadPhaseCastResult result,
BroadPhaseLayerFilter broadPhaseLayerFilter = default,
ObjectLayerFilter objectLayerFilter = default
) =>
Jolt.PInvoke.BroadPhaseQuery_CastAABoxClosest(
this,
in box,
out result,
broadPhaseLayerFilter,
objectLayerFilter
) != 0;
///
///
/// Get the bounding box of all objects in the broadphase
///
///
/// C++:
/// Jolt/Physics/Collision/BroadPhase/BroadPhaseQuery.h:53
///
/// virtual AABox GetBounds() const = 0
///
///
public AABox GetBounds() => Jolt.PInvoke.BroadPhaseQuery_GetBounds(this);
}
}