brutal/Brutal.Jolt/Generated/Classes/Shape.gen.cs
Rian Drake b578433e37 first
2026-10-15 17:10:50 +13:00

1335 lines
67 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>
/// Base class for all shapes (collision volume of a body). Defines a virtual interface for collision detection.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L184">Jolt/Physics/Collision/Shape/Shape.h:184</see>
/// <br/>
/// <c>class Shape : public RefTarget&lt;Shape&gt;, public NonCopyable</c>
/// </para>
/// </summary>
[InteropHandle]
public readonly partial struct Shape : IDisposable
{
/// <summary>
/// <para>
/// An opaque buffer that holds shape specific information during GetTrianglesStart/Next.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L347">Jolt/Physics/Collision/Shape/Shape.h:347</see>
/// <br/>
/// <c>struct alignas(16) GetTrianglesContext { uint8 mData[4288]; }</c>
/// </para>
/// </summary>
[StructLayout(LayoutKind.Explicit, Size = 4288)]
public partial struct GetTrianglesContext
{
/// <summary>
/// <para>
/// An opaque buffer that holds shape specific information during GetTrianglesStart/Next.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L347">Jolt/Physics/Collision/Shape/Shape.h:347</see>
/// <br/>
/// <c>uint8 mData[4288]</c>
/// </para>
/// </summary>
[FieldOffset(0)]
public byte_4288 Data;
}
/// <summary>
/// <para>
/// Class that holds information about the shape that can be used for logging / data collection purposes
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L406">Jolt/Physics/Collision/Shape/Shape.h:406</see>
/// <br/>
/// <c>struct Stats</c>
/// </para>
/// </summary>
[StructLayout(LayoutKind.Explicit, Size = 16)]
public partial struct Stats
{
/// <summary>
/// <para>
/// Amount of memory used by this shape (size in bytes)
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L410">Jolt/Physics/Collision/Shape/Shape.h:410</see>
/// <br/>
/// <c>size_t mSizeBytes</c>
/// </para>
/// </summary>
[FieldOffset(0)]
public nuint SizeBytes;
/// <summary>
/// <para>
/// Number of triangles in this shape (when applicable)
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L411">Jolt/Physics/Collision/Shape/Shape.h:411</see>
/// <br/>
/// <c>uint mNumTriangles</c>
/// </para>
/// </summary>
[FieldOffset(8)]
public uint NumTriangles;
}
/// <summary>
/// <para>
/// Get type
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L199">Jolt/Physics/Collision/Shape/Shape.h:199</see>
/// <br/>
/// <c>inline EShapeType GetType() const</c>
/// </para>
/// </summary>
public ShapeType GetShapeType() => Jolt.PInvoke.Shape_GetShapeType(this);
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L200">Jolt/Physics/Collision/Shape/Shape.h:200</see>
/// <br/>
/// <c>inline EShapeSubType GetSubType() const</c>
/// </para>
/// </summary>
public ShapeSubType GetSubType() => Jolt.PInvoke.Shape_GetSubType(this);
/// <summary>
/// <para>
/// User data (to be used freely by the application)
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L203">Jolt/Physics/Collision/Shape/Shape.h:203</see>
/// <br/>
/// <c>uint64 GetUserData() const</c>
/// </para>
/// </summary>
public ulong GetUserData() => Jolt.PInvoke.Shape_GetUserData(this);
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L204">Jolt/Physics/Collision/Shape/Shape.h:204</see>
/// <br/>
/// <c>void SetUserData(uint64 inUserData)</c>
/// </para>
/// </summary>
public void SetUserData(ulong userData) => Jolt.PInvoke.Shape_SetUserData(this, userData);
/// <summary>
/// <para>
/// Check if this shape can only be used to create a static body or if it can also be dynamic/kinematic
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L207">Jolt/Physics/Collision/Shape/Shape.h:207</see>
/// <br/>
/// <c>virtual bool MustBeStatic() const</c>
/// </para>
/// </summary>
public bool MustBeStatic() => Jolt.PInvoke.Shape_MustBeStatic(this);
/// <summary>
/// <para>
/// All shapes are centered around their center of mass. This function returns the center of mass position
/// that needs to be applied to transform the shape to where it was created.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L210">Jolt/Physics/Collision/Shape/Shape.h:210</see>
/// <br/>
/// <c>virtual Vec3 GetCenterOfMass() const</c>
/// </para>
/// </summary>
public float3 GetCenterOfMass() => Jolt.PInvoke.Shape_GetCenterOfMass(this);
/// <summary>
/// <para>
/// Get local bounding box including convex radius, this box is centered around the center of mass rather
/// than the world transform
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L213">Jolt/Physics/Collision/Shape/Shape.h:213</see>
/// <br/>
/// <c>virtual AABox GetLocalBounds() const = 0</c>
/// </para>
/// </summary>
public AABox GetLocalBounds() => Jolt.PInvoke.Shape_GetLocalBounds(this);
/// <summary>
/// <para>
/// Get the max number of sub shape ID bits that are needed to be able to address any leaf shape in this
/// shape. Used mainly for checking that it is smaller or equal than SubShapeID::MaxBits.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L216">Jolt/Physics/Collision/Shape/Shape.h:216</see>
/// <br/>
/// <c>virtual uint GetSubShapeIDBitsRecursive() const = 0</c>
/// </para>
/// </summary>
public uint GetSubShapeIDBitsRecursive() => Jolt.PInvoke.Shape_GetSubShapeIDBitsRecursive(this);
/// <summary>
/// <para>
/// Get world space bounds including convex radius. This shape is scaled by inScale in local space first.
/// This function can be overridden to return a closer fitting world space bounding box, by default it will
/// just transform what GetLocalBounds() returns.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L221">Jolt/Physics/Collision/Shape/Shape.h:221</see>
/// <br/>
/// <c>virtual AABox GetWorldSpaceBounds(Mat44Arg inCenterOfMassTransform, Vec3Arg inScale) const</c>
/// </para>
/// </summary>
public AABox GetWorldSpaceBounds(in float4x4 centerOfMassTransform, float3 scale) =>
Jolt.PInvoke.Shape_GetWorldSpaceBounds(this, in centerOfMassTransform, scale);
/// <summary>
/// <para>
/// Get world space bounds including convex radius.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L224">Jolt/Physics/Collision/Shape/Shape.h:224</see>
/// <br/>
/// <c>AABox GetWorldSpaceBounds(DMat44Arg inCenterOfMassTransform, Vec3Arg inScale) const</c>
/// </para>
/// </summary>
public AABox GetWorldSpaceBounds(in double4x4 centerOfMassTransform, float3 scale) =>
Jolt.PInvoke.Shape_GetWorldSpaceBounds_2(this, in centerOfMassTransform, scale);
/// <summary>
/// <para>
/// Returns the radius of the biggest sphere that fits entirely in the shape. In case this shape consists of
/// multiple sub shapes, it returns the smallest sphere of the parts. This can be used as a measure of how
/// far the shape can be moved without risking going through geometry.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L237">Jolt/Physics/Collision/Shape/Shape.h:237</see>
/// <br/>
/// <c>virtual float GetInnerRadius() const = 0</c>
/// </para>
/// </summary>
public float GetInnerRadius() => Jolt.PInvoke.Shape_GetInnerRadius(this);
/// <summary>
/// <para>
/// Calculate the mass and inertia of this shape
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L240">Jolt/Physics/Collision/Shape/Shape.h:240</see>
/// <br/>
/// <c>virtual MassProperties GetMassProperties() const = 0</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// The returned handle is an owned copy; Dispose it when you're done with it.
/// </para>
/// </remarks>
public MassProperties GetMassProperties() => Jolt.PInvoke.Shape_GetMassProperties(this);
/// <summary>
/// <para>
/// Get the leaf shape for a particular sub shape ID.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L246">Jolt/Physics/Collision/Shape/Shape.h:246</see>
/// <br/>
/// <c>virtual const Shape * GetLeafShape(const SubShapeID &amp;inSubShapeID, SubShapeID &amp;outRemainder) const</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Get the leaf shape for a particular sub shape ID.
/// @param inSubShapeID The full sub shape ID that indicates the path to the leaf shape
/// @param outRemainder What remains of the sub shape ID after removing the path to the leaf shape (could e.g. refer to a triangle within a MeshShape)
/// @return The shape or null if the sub shape ID is invalid
/// </code>
/// <para>
/// The returned handle carries its own reference; Dispose it once when you're done.
/// </para>
/// </remarks>
public Shape GetLeafShape(uint subShapeID, out uint remainder) =>
Jolt.PInvoke.Shape_GetLeafShape(this, subShapeID, out remainder);
/// <summary>
/// <para>
/// Get the material assigned to a particular sub shape ID
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L249">Jolt/Physics/Collision/Shape/Shape.h:249</see>
/// <br/>
/// <c>virtual const PhysicsMaterial * GetMaterial(const SubShapeID &amp;inSubShapeID) const = 0</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// The returned handle carries its own reference; Dispose it once when you're done.
/// </para>
/// </remarks>
public PhysicsMaterial GetMaterial(uint subShapeID) => Jolt.PInvoke.Shape_GetMaterial(this, subShapeID);
/// <summary>
/// <para>
/// Get the surface normal of a particular sub shape ID and point on surface (all vectors are relative to
/// center of mass for this shape). Note: When you have a CollideShapeResult or ShapeCastResult you should
/// use -mPenetrationAxis.Normalized() as contact normal as GetSurfaceNormal will only return face normals
/// (and not vertex or edge normals).
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L253">Jolt/Physics/Collision/Shape/Shape.h:253</see>
/// <br/>
/// <c>virtual Vec3 GetSurfaceNormal(const SubShapeID &amp;inSubShapeID, Vec3Arg inLocalSurfacePosition) const = 0</c>
/// </para>
/// </summary>
public float3 GetSurfaceNormal(uint subShapeID, float3 localSurfacePosition) =>
Jolt.PInvoke.Shape_GetSurfaceNormal(this, subShapeID, localSurfacePosition);
/// <summary>
/// <para>
/// Get the vertices of the face that faces inDirection the most (includes any convex radius). Note that
/// this function can only return faces of convex shapes or triangles, which is why a sub shape ID to get to
/// that leaf must be provided.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L265">Jolt/Physics/Collision/Shape/Shape.h:265</see>
/// <br/>
/// <c>virtual void GetSupportingFace(const SubShapeID &amp;inSubShapeID, Vec3Arg inDirection, Vec3Arg inScale, Mat44Arg inCenterOfMassTransform, SupportingFace &amp;outVertices) const</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Get the vertices of the face that faces inDirection the most (includes any convex radius). Note that this function can only return faces of
/// convex shapes or triangles, which is why a sub shape ID to get to that leaf must be provided.
/// @param inSubShapeID Sub shape ID of target shape
/// @param inDirection Direction that the face should be facing (in local space to this shape)
/// @param inCenterOfMassTransform Transform to transform outVertices with
/// @param inScale Scale in local space of the shape (scales relative to its center of mass)
/// @param outVertices Resulting face. The returned face can be empty if the shape doesn't have polygons to return (e.g. because it's a sphere). The face will be returned in world space.
/// </code>
/// </remarks>
public void GetSupportingFace(
uint subShapeID,
float3 direction,
float3 scale,
in float4x4 centerOfMassTransform,
out StaticArrayVec3_32 vertices
) =>
Jolt.PInvoke.Shape_GetSupportingFace(
this,
subShapeID,
direction,
scale,
in centerOfMassTransform,
out vertices
);
/// <summary>
/// <para>
/// Get the user data of a particular sub shape ID. Corresponds with the value stored in Shape::GetUserData
/// of the leaf shape pointed to by inSubShapeID.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L268">Jolt/Physics/Collision/Shape/Shape.h:268</see>
/// <br/>
/// <c>virtual uint64 GetSubShapeUserData(const SubShapeID &amp;inSubShapeID) const</c>
/// </para>
/// </summary>
public ulong GetSubShapeUserData(uint subShapeID) => Jolt.PInvoke.Shape_GetSubShapeUserData(this, subShapeID);
/// <summary>
/// <para>
/// Get the direct child sub shape and its transform for a sub shape ID.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L277">Jolt/Physics/Collision/Shape/Shape.h:277</see>
/// <br/>
/// <c>virtual TransformedShape GetSubShapeTransformedShape(const SubShapeID &amp;inSubShapeID, Vec3Arg inPositionCOM, QuatArg inRotation, Vec3Arg inScale, SubShapeID &amp;outRemainder) const</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Get the direct child sub shape and its transform for a sub shape ID.
/// @param inSubShapeID Sub shape ID that indicates the path to the leaf shape
/// @param inPositionCOM The position of the center of mass of this shape
/// @param inRotation The orientation of this shape
/// @param inScale Scale in local space of the shape (scales relative to its center of mass)
/// @param outRemainder The remainder of the sub shape ID after removing the sub shape
/// @return Direct child sub shape and its transform, note that the body ID and sub shape ID will be invalid
/// </code>
/// <para>
/// The returned handle is an owned copy; Dispose it when you're done with it.
/// </para>
/// </remarks>
public TransformedShape GetSubShapeTransformedShape(
uint subShapeID,
float3 positionCOM,
floatQuat rotation,
float3 scale,
out uint remainder
) =>
Jolt.PInvoke.Shape_GetSubShapeTransformedShape(
this,
subShapeID,
positionCOM,
rotation,
scale,
out remainder
);
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L289">Jolt/Physics/Collision/Shape/Shape.h:289</see>
/// <br/>
/// <c>virtual void GetSubmergedVolume(Mat44Arg inCenterOfMassTransform, Vec3Arg inScale, const Plane &amp;inSurface, float &amp;outTotalVolume, float &amp;outSubmergedVolume, Vec3 &amp;outCenterOfBuoyancy</c>
/// </para>
/// </summary>
public void GetSubmergedVolume(
in float4x4 centerOfMassTransform,
float3 scale,
in Plane surface,
out float totalVolume,
out float submergedVolume,
out float3 centerOfBuoyancy,
float3 baseOffset
) =>
Jolt.PInvoke.Shape_GetSubmergedVolume(
this,
in centerOfMassTransform,
scale,
in surface,
out totalVolume,
out submergedVolume,
out centerOfBuoyancy,
baseOffset
);
/// <summary>
/// <para>
/// Draw the shape at a particular location with a particular color (debugging purposes)
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L297">Jolt/Physics/Collision/Shape/Shape.h:297</see>
/// <br/>
/// <c>virtual void Draw(DebugRenderer *inRenderer, RMat44Arg inCenterOfMassTransform, Vec3Arg inScale, ColorArg inColor, bool inUseMaterialColors, bool inDrawWireframe) const = 0</c>
/// </para>
/// </summary>
public void Draw(
DebugRenderer renderer,
in float4x4 centerOfMassTransform,
float3 scale,
uint color,
bool useMaterialColors,
bool drawWireframe
) =>
Jolt.PInvoke.Shape_Draw(
this,
renderer,
in centerOfMassTransform,
scale,
color,
useMaterialColors,
drawWireframe
);
/// <summary>
/// <para>
/// Draw the results of the GetSupportFunction with the convex radius added back on to show any errors
/// introduced by this process (only relevant for convex shapes)
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L300">Jolt/Physics/Collision/Shape/Shape.h:300</see>
/// <br/>
/// <c>virtual void DrawGetSupportFunction(DebugRenderer *inRenderer, RMat44Arg inCenterOfMassTransform, Vec3Arg inScale, ColorArg inColor, bool inDrawSupportDirection) const</c>
/// </para>
/// </summary>
public void DrawGetSupportFunction(
DebugRenderer renderer,
in float4x4 centerOfMassTransform,
float3 scale,
uint color,
bool drawSupportDirection
) =>
Jolt.PInvoke.Shape_DrawGetSupportFunction(
this,
renderer,
in centerOfMassTransform,
scale,
color,
drawSupportDirection
);
/// <summary>
/// <para>
/// Draw the results of the GetSupportingFace function to show any errors introduced by this process (only
/// relevant for convex shapes)
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L303">Jolt/Physics/Collision/Shape/Shape.h:303</see>
/// <br/>
/// <c>virtual void DrawGetSupportingFace(DebugRenderer *inRenderer, RMat44Arg inCenterOfMassTransform, Vec3Arg inScale) const</c>
/// </para>
/// </summary>
public void DrawGetSupportingFace(DebugRenderer renderer, in float4x4 centerOfMassTransform, float3 scale) =>
Jolt.PInvoke.Shape_DrawGetSupportingFace(this, renderer, in centerOfMassTransform, scale);
/// <summary>
/// <para>
/// Cast a ray against this shape, returns true if it finds a hit closer than ioHit.mFraction and updates
/// that fraction. Otherwise ioHit is left untouched and the function returns false. Note that the ray
/// should be relative to the center of mass of this shape (i.e. subtract Shape::GetCenterOfMass() from
/// RayCast::mOrigin if you want to cast against the shape in the space it was created). Convex objects will
/// be treated as solid (meaning if the ray starts inside, you'll get a hit fraction of 0) and back face
/// hits against triangles are returned. If you want the surface normal of the hit use
/// GetSurfaceNormal(ioHit.mSubShapeID2, inRay.GetPointOnRay(ioHit.mFraction)).
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L310">Jolt/Physics/Collision/Shape/Shape.h:310</see>
/// <br/>
/// <c>virtual bool CastRay(const RayCast &amp;inRay, const SubShapeIDCreator &amp;inSubShapeIDCreator, RayCastResult &amp;ioHit) const = 0</c>
/// </para>
/// </summary>
public bool CastRay(in RayCast ray, SubShapeIDCreator subShapeIDCreator, ref RayCastResult hit) =>
Jolt.PInvoke.Shape_CastRay(this, in ray, subShapeIDCreator, ref hit);
/// <summary>
/// <para>
/// Cast a ray against this shape. Allows returning multiple hits through ioCollector. Note that this
/// version is more flexible but also slightly slower than the CastRay function that returns only a single
/// hit. If you want the surface normal of the hit use GetSurfaceNormal(collected sub shape ID,
/// inRay.GetPointOnRay(collected faction)).
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L314">Jolt/Physics/Collision/Shape/Shape.h:314</see>
/// <br/>
/// <c>virtual void CastRay(const RayCast &amp;inRay, const RayCastSettings &amp;inRayCastSettings, const SubShapeIDCreator &amp;inSubShapeIDCreator, CastRayCollector &amp;ioCollector, const ShapeFilter &amp;inShapeFilter = { }) const = 0</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// 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.
/// </para>
/// </remarks>
public unsafe uint CastRay(
in RayCast ray,
RayCastSettings rayCastSettings,
SubShapeIDCreator subShapeIDCreator,
Span<RayCastResult> results,
out uint totalHits,
ShapeFilter shapeFilter = default
)
{
fixed (RayCastResult* results_fixed = results)
{
totalHits = Jolt.PInvoke.Shape_CastRay_2(
this,
in ray,
rayCastSettings,
subShapeIDCreator,
results_fixed,
(uint)results.Length,
shapeFilter
);
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
}
}
/// <summary>
/// <para>
/// Cast a ray against this shape. Allows returning multiple hits through ioCollector. Note that this
/// version is more flexible but also slightly slower than the CastRay function that returns only a single
/// hit. If you want the surface normal of the hit use GetSurfaceNormal(collected sub shape ID,
/// inRay.GetPointOnRay(collected faction)).
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L314">Jolt/Physics/Collision/Shape/Shape.h:314</see>
/// <br/>
/// <c>virtual void CastRay(const RayCast &amp;inRay, const RayCastSettings &amp;inRayCastSettings, const SubShapeIDCreator &amp;inSubShapeIDCreator, CastRayCollector &amp;ioCollector, const ShapeFilter &amp;inShapeFilter = { }) const = 0</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>
/// </remarks>
public bool CastRayClosest(
in RayCast ray,
RayCastSettings rayCastSettings,
SubShapeIDCreator subShapeIDCreator,
out RayCastResult result,
ShapeFilter shapeFilter = default
) =>
Jolt.PInvoke.Shape_CastRayClosest(this, in ray, rayCastSettings, subShapeIDCreator, out result, shapeFilter)
!= 0;
/// <summary>
/// <para>
/// Check if inPoint is inside this shape. For this tests all shapes are treated as if they were solid. Note
/// that inPoint should be relative to the center of mass of this shape (i.e. subtract
/// Shape::GetCenterOfMass() from inPoint if you want to test against the shape in the space it was
/// created). For a mesh shape, this test will only provide sensible information if the mesh is a closed
/// manifold. For each shape that collides, ioCollector will receive a hit.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L320">Jolt/Physics/Collision/Shape/Shape.h:320</see>
/// <br/>
/// <c>virtual void CollidePoint(Vec3Arg inPoint, const SubShapeIDCreator &amp;inSubShapeIDCreator, CollidePointCollector &amp;ioCollector, const ShapeFilter &amp;inShapeFilter = { }) const = 0</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// 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.
/// </para>
/// </remarks>
public unsafe uint CollidePoint(
float3 point,
SubShapeIDCreator subShapeIDCreator,
Span<CollidePointResult> results,
out uint totalHits,
ShapeFilter shapeFilter = default
)
{
fixed (CollidePointResult* results_fixed = results)
{
totalHits = Jolt.PInvoke.Shape_CollidePoint(
this,
point,
subShapeIDCreator,
results_fixed,
(uint)results.Length,
shapeFilter
);
return totalHits < (uint)results.Length ? totalHits : (uint)results.Length;
}
}
/// <summary>
/// <para>
/// Collides all vertices of a soft body with this shape and updates SoftBodyVertex::mCollisionPlane,
/// SoftBodyVertex::mCollidingShapeIndex and SoftBodyVertex::mLargestPenetration if a collision with more
/// penetration was found.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L328">Jolt/Physics/Collision/Shape/Shape.h:328</see>
/// <br/>
/// <c>virtual void CollideSoftBodyVertices(Mat44Arg inCenterOfMassTransform, Vec3Arg inScale, const CollideSoftBodyVertexIterator &amp;inVertices, uint inNumVertices, int inCollidingShapeIndex) const = 0</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Collides all vertices of a soft body with this shape and updates SoftBodyVertex::mCollisionPlane, SoftBodyVertex::mCollidingShapeIndex and SoftBodyVertex::mLargestPenetration if a collision with more penetration was found.
/// @param inCenterOfMassTransform Center of mass transform for this shape relative to the vertices.
/// @param inScale Scale in local space of the shape (scales relative to its center of mass)
/// @param inVertices The vertices of the soft body
/// @param inNumVertices The number of vertices in inVertices
/// @param inCollidingShapeIndex Value to store in CollideSoftBodyVertexIterator::mCollidingShapeIndex when a collision was found
/// </code>
/// </remarks>
public void CollideSoftBodyVertices(
in float4x4 centerOfMassTransform,
float3 scale,
CollideSoftBodyVertexIterator vertices,
uint numVertices,
int collidingShapeIndex
) =>
Jolt.PInvoke.Shape_CollideSoftBodyVertices(
this,
in centerOfMassTransform,
scale,
vertices,
numVertices,
collidingShapeIndex
);
/// <summary>
/// <para>
/// Collect the leaf transformed shapes of all leaf shapes of this shape. inBox is the world space axis
/// aligned box which leaf shapes should collide with. inPositionCOM/inRotation/inScale describes the
/// transform of this shape. inSubShapeIDCreator represents the current sub shape ID of this shape.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L334">Jolt/Physics/Collision/Shape/Shape.h:334</see>
/// <br/>
/// <c>virtual void CollectTransformedShapes(const AABox &amp;inBox, Vec3Arg inPositionCOM, QuatArg inRotation, Vec3Arg inScale, const SubShapeIDCreator &amp;inSubShapeIDCreator, TransformedShapeCollector &amp;ioCollector, const ShapeFilter &amp;inShapeFilter) const</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// Returns every shape the query collected as an owned buffer of TransformedShape: Dispose it when done. It
/// holds a reference to each shape, so the handles it hands out stay valid until then even if the bodies go
/// - but they are borrowed from the buffer, so never Dispose one.
/// </para>
/// <para>
/// Pass default for shapeFilter to filter nothing out.
/// </para>
/// </remarks>
public NativeHandleArray<TransformedShape> CollectTransformedShapes(
in AABox box,
float3 positionCOM,
floatQuat rotation,
float3 scale,
SubShapeIDCreator subShapeIDCreator,
ShapeFilter shapeFilter
) =>
new NativeHandleArray<TransformedShape>(
Jolt.PInvoke.Shape_CollectTransformedShapes(
this,
in box,
positionCOM,
rotation,
scale,
subShapeIDCreator,
shapeFilter
)
);
/// <summary>
/// <para>
/// Transforms this shape and all of its children with inTransform, resulting shape(s) are passed to
/// ioCollector. Note that not all shapes support all transforms (especially true for scaling), the
/// resulting shape will try to match the transform as accurately as possible.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L340">Jolt/Physics/Collision/Shape/Shape.h:340</see>
/// <br/>
/// <c>virtual void TransformShape(Mat44Arg inCenterOfMassTransform, TransformedShapeCollector &amp;ioCollector) const</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Transforms this shape and all of its children with inTransform, resulting shape(s) are passed to ioCollector.
/// Note that not all shapes support all transforms (especially true for scaling), the resulting shape will try to match the transform as accurately as possible.
/// @param inCenterOfMassTransform The transform (rotation, translation, scale) that the center of mass of the shape should get
/// @param ioCollector The transformed shapes will be passed to this collector
/// </code>
/// <para>
/// Returns every shape the query collected as an owned buffer of TransformedShape: Dispose it when done. It
/// holds a reference to each shape, so the handles it hands out stay valid until then even if the bodies go
/// - but they are borrowed from the buffer, so never Dispose one.
/// </para>
/// </remarks>
public NativeHandleArray<TransformedShape> TransformShape(in float4x4 centerOfMassTransform) =>
new NativeHandleArray<TransformedShape>(Jolt.PInvoke.Shape_TransformShape(this, in centerOfMassTransform));
/// <summary>
/// <para>
/// Scale this shape. Note that not all shapes support all scales, this will return a shape that matches the
/// scale as accurately as possible. See Shape::IsValidScale for more information.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L344">Jolt/Physics/Collision/Shape/Shape.h:344</see>
/// <br/>
/// <c>ShapeResult ScaleShape(Vec3Arg inScale) const</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Scale this shape. Note that not all shapes support all scales, this will return a shape that matches the scale as accurately as possible. See Shape::IsValidScale for more information.
/// @param inScale The scale to use for this shape (note: this scale is applied to the entire shape in the space it was created, most other functions apply the scale in the space of the leaf shapes and from the center of mass!)
/// </code>
/// <para>
/// Throws JoltException with Jolt's error message when the operation fails.
/// </para>
/// </remarks>
public Shape ScaleShape(float3 scale)
{
var _handle = Jolt.PInvoke.Shape_ScaleShape(this, scale);
if (_handle.IsNull())
throw JoltException.FromLastError();
return _handle;
}
/// <summary>
/// <para>
/// To start iterating over triangles, call this function first. ioContext is a temporary buffer and should
/// remain untouched until the last call to GetTrianglesNext. inBox is the world space bounding in which you
/// want to get the triangles. inPositionCOM/inRotation/inScale describes the transform of this shape. To
/// get the actual triangles call GetTrianglesNext.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L357">Jolt/Physics/Collision/Shape/Shape.h:357</see>
/// <br/>
/// <c>virtual void GetTrianglesStart(GetTrianglesContext &amp;ioContext, const AABox &amp;inBox, Vec3Arg inPositionCOM, QuatArg inRotation, Vec3Arg inScale) const = 0</c>
/// </para>
/// </summary>
public void GetTrianglesStart(
ref Shape.GetTrianglesContext context,
in AABox box,
float3 positionCOM,
floatQuat rotation,
float3 scale
) => Jolt.PInvoke.Shape_GetTrianglesStart(this, ref context, in box, positionCOM, rotation, scale);
/// <summary>
/// <para>
/// Call this repeatedly to get all triangles in the box. outTriangleVertices should be large enough to hold
/// 3 * inMaxTriangleRequested entries. outMaterials (if it is not null) should contain
/// inMaxTrianglesRequested entries. The function returns the amount of triangles that it found (which will
/// be &lt;= inMaxTrianglesRequested), or 0 if there are no more triangles. Note that the function can
/// return a value &lt; inMaxTrianglesRequested and still have more triangles to process (triangles can be
/// returned in blocks). Note that the function may return triangles outside of the requested box, only
/// coarse culling is performed on the returned triangles.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L365">Jolt/Physics/Collision/Shape/Shape.h:365</see>
/// <br/>
/// <c>virtual int GetTrianglesNext(GetTrianglesContext &amp;ioContext, int inMaxTrianglesRequested, Float3 *outTriangleVertices, const PhysicsMaterial **outMaterials = nullptr) const = 0</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// materials is a buffer of PhysicsMaterial handles you allocate and size; the handles the call writes into
/// it are borrowed from their owner - don't Dispose them.
/// </para>
/// </remarks>
public unsafe int GetTrianglesNext(
ref Shape.GetTrianglesContext context,
int maxTrianglesRequested,
Ptr<float3> triangleVertices,
Ptr<PhysicsMaterial> materials = default
) => Jolt.PInvoke.Shape_GetTrianglesNext(this, ref context, maxTrianglesRequested, triangleVertices, materials);
/// <summary>
/// <para>
/// Saves the contents of the shape in binary form to inStream.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L375">Jolt/Physics/Collision/Shape/Shape.h:375</see>
/// <br/>
/// <c>virtual void SaveBinaryState(StreamOut &amp;inStream) const</c>
/// </para>
/// </summary>
public void SaveBinaryState(StreamOut stream) => Jolt.PInvoke.Shape_SaveBinaryState(this, stream);
/// <summary>
/// <para>
/// Creates a Shape of the correct type and restores its contents from the binary stream inStream.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L378">Jolt/Physics/Collision/Shape/Shape.h:378</see>
/// <br/>
/// <c>static ShapeResult sRestoreFromBinaryState(StreamIn &amp;inStream)</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// Throws JoltException with Jolt's error message when the operation fails.
/// </para>
/// </remarks>
public static Shape RestoreFromBinaryState(StreamIn stream)
{
var _handle = Jolt.PInvoke.Shape_RestoreFromBinaryState(stream);
if (_handle.IsNull())
throw JoltException.FromLastError();
return _handle;
}
/// <summary>
/// <para>
/// Outputs the material references that this shape has to outMaterials.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L381">Jolt/Physics/Collision/Shape/Shape.h:381</see>
/// <br/>
/// <c>virtual void SaveMaterialState(PhysicsMaterialList &amp;outMaterials) const</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// Returns an owned native buffer - read it through AsSpan() and Dispose it when you are done with it. The
/// handles in it are borrowed views into the buffer: they stay valid until Dispose and must not be disposed
/// themselves.
/// </para>
/// </remarks>
public NativeArray<PhysicsMaterial> SaveMaterialState()
{
Jolt.PInvoke.Shape_SaveMaterialState(this, out var materials_raw);
return new NativeArray<PhysicsMaterial>(materials_raw);
}
/// <summary>
/// <para>
/// Restore the material references after calling sRestoreFromBinaryState. Note that the exact same
/// materials need to be provided in the same order as returned by SaveMaterialState.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L384">Jolt/Physics/Collision/Shape/Shape.h:384</see>
/// <br/>
/// <c>virtual void RestoreMaterialState(const PhysicsMaterialRefC *inMaterials, uint inNumMaterials)</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// materials is the buffer the native call reads, and its element count travels with it: the span is only
/// read, and it is only read for the duration of the call.
/// </para>
/// </remarks>
public unsafe void RestoreMaterialState(ReadOnlySpan<PhysicsMaterial> materials)
{
fixed (PhysicsMaterial* materials_fixed = materials)
{
Jolt.PInvoke.Shape_RestoreMaterialState(this, materials_fixed, (uint)materials.Length);
}
}
/// <summary>
/// <para>
/// Outputs the shape references that this shape has to outSubShapes.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L387">Jolt/Physics/Collision/Shape/Shape.h:387</see>
/// <br/>
/// <c>virtual void SaveSubShapeState(ShapeList &amp;outSubShapes) const</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// Returns an owned native buffer - read it through AsSpan() and Dispose it when you are done with it. The
/// handles in it are borrowed views into the buffer: they stay valid until Dispose and must not be disposed
/// themselves.
/// </para>
/// </remarks>
public NativeArray<Shape> SaveSubShapeState()
{
Jolt.PInvoke.Shape_SaveSubShapeState(this, out var subShapes_raw);
return new NativeArray<Shape>(subShapes_raw);
}
/// <summary>
/// <para>
/// Restore the shape references after calling sRestoreFromBinaryState. Note that the exact same shapes need
/// to be provided in the same order as returned by SaveSubShapeState.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L390">Jolt/Physics/Collision/Shape/Shape.h:390</see>
/// <br/>
/// <c>virtual void RestoreSubShapeState(const ShapeRefC *inSubShapes, uint inNumShapes)</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// subShapes is the buffer the native call reads, and its element count travels with it: the span is only
/// read, and it is only read for the duration of the call.
/// </para>
/// </remarks>
public unsafe void RestoreSubShapeState(ReadOnlySpan<Shape> subShapes)
{
fixed (Shape* subShapes_fixed = subShapes)
{
Jolt.PInvoke.Shape_RestoreSubShapeState(this, subShapes_fixed, (uint)subShapes.Length);
}
}
/// <summary>
/// <para>
/// Save this shape, all its children and its materials. Pass in an empty map in ioShapeMap / ioMaterialMap
/// or reuse the same map while saving multiple shapes to the same stream in order to avoid writing
/// duplicates.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L398">Jolt/Physics/Collision/Shape/Shape.h:398</see>
/// <br/>
/// <c>void SaveWithChildren(StreamOut &amp;inStream, ShapeToIDMap &amp;ioShapeMap, MaterialToIDMap &amp;ioMaterialMap) const</c>
/// </para>
/// </summary>
public void SaveWithChildren(StreamOut stream, ShapeToIDMap shapeMap, MaterialToIDMap materialMap) =>
Jolt.PInvoke.Shape_SaveWithChildren(this, stream, shapeMap, materialMap);
/// <summary>
/// <para>
/// Restore a shape, all its children and materials. Pass in an empty map in ioShapeMap / ioMaterialMap or
/// reuse the same map while reading multiple shapes from the same stream in order to restore duplicates.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L401">Jolt/Physics/Collision/Shape/Shape.h:401</see>
/// <br/>
/// <c>static ShapeResult sRestoreWithChildren(StreamIn &amp;inStream, IDToShapeMap &amp;ioShapeMap, IDToMaterialMap &amp;ioMaterialMap)</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// Throws JoltException with Jolt's error message when the operation fails.
/// </para>
/// </remarks>
public static Shape RestoreWithChildren(StreamIn stream, IDToShapeMap shapeMap, IDToMaterialMap materialMap)
{
var _handle = Jolt.PInvoke.Shape_RestoreWithChildren(stream, shapeMap, materialMap);
if (_handle.IsNull())
throw JoltException.FromLastError();
return _handle;
}
/// <summary>
/// <para>
/// Get stats of this shape. Use for logging / data collection purposes only. Does not add values from child
/// shapes, use GetStatsRecursive for this.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L415">Jolt/Physics/Collision/Shape/Shape.h:415</see>
/// <br/>
/// <c>virtual Stats GetStats() const = 0</c>
/// </para>
/// </summary>
public Shape.Stats GetStats()
{
Jolt.PInvoke.Shape_GetStats(this, out var _outResult);
return _outResult;
}
/// <summary>
/// <para>
/// &lt; Volume of this shape (m^3). Note that for compound shapes the volume may be incorrect since child
/// shapes can overlap which is not accounted for.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L424">Jolt/Physics/Collision/Shape/Shape.h:424</see>
/// <br/>
/// <c>virtual float GetVolume() const = 0</c>
/// </para>
/// </summary>
public float GetVolume() => Jolt.PInvoke.Shape_GetVolume(this);
/// <summary>
/// <para>
/// Test if inScale is a valid scale for this shape. Some shapes can only be scaled uniformly, compound
/// shapes cannot handle shapes being rotated and scaled (this would cause shearing), scale can never be
/// zero. When the scale is invalid, the function will return false.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L438">Jolt/Physics/Collision/Shape/Shape.h:438</see>
/// <br/>
/// <c>virtual bool IsValidScale(Vec3Arg inScale) const</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// Test if inScale is a valid scale for this shape. Some shapes can only be scaled uniformly, compound shapes cannot handle shapes
/// being rotated and scaled (this would cause shearing), scale can never be zero. When the scale is invalid, the function will return false.
///
/// Here's a list of supported scales:
/// * SphereShape: Scale must be uniform (signs of scale are ignored).
/// * BoxShape: Any scale supported (signs of scale are ignored).
/// * TriangleShape: Any scale supported when convex radius is zero, otherwise only uniform scale supported.
/// * CapsuleShape: Scale must be uniform (signs of scale are ignored).
/// * TaperedCapsuleShape: Scale must be uniform (sign of Y scale can be used to flip the capsule).
/// * CylinderShape: Scale must be uniform in XZ plane, Y can scale independently (signs of scale are ignored).
/// * RotatedTranslatedShape: Scale must not cause shear in the child shape.
/// * CompoundShape: Scale must not cause shear in any of the child shapes.
/// </code>
/// </remarks>
public bool IsValidScale(float3 scale) => Jolt.PInvoke.Shape_IsValidScale(this, scale);
/// <summary>
/// <para>
/// This function will make sure that if you wrap this shape in a ScaledShape that the scale is valid. Note
/// that this involves discarding components of the scale that are invalid, so the resulting scaled shape
/// may be different than the requested scale. Compare the return value of this function with the scale you
/// passed in to detect major inconsistencies and possibly warn the user.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L445">Jolt/Physics/Collision/Shape/Shape.h:445</see>
/// <br/>
/// <c>virtual Vec3 MakeScaleValid(Vec3Arg inScale) const</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// This function will make sure that if you wrap this shape in a ScaledShape that the scale is valid.
/// Note that this involves discarding components of the scale that are invalid, so the resulting scaled shape may be different than the requested scale.
/// Compare the return value of this function with the scale you passed in to detect major inconsistencies and possibly warn the user.
/// @param inScale Local space scale for this shape.
/// @return Scale that can be used to wrap this shape in a ScaledShape. IsValidScale will return true for this scale.
/// </code>
/// </remarks>
public float3 MakeScaleValid(float3 scale) => Jolt.PInvoke.Shape_MakeScaleValid(this, scale);
/// <summary>
/// <para>
/// Views this Shape as the ConvexShape it is, or returns a null handle when it is a different kind - check
/// IsNull(). The same object, not a new reference: never Dispose the result.
/// </para>
/// </summary>
public ConvexShape AsConvexShape() => Jolt.PInvoke.Shape_AsConvexShape(this);
/// <summary>
/// <para>
/// Views this Shape as the CompoundShape it is, or returns a null handle when it is a different kind -
/// check IsNull(). The same object, not a new reference: never Dispose the result.
/// </para>
/// </summary>
public CompoundShape AsCompoundShape() => Jolt.PInvoke.Shape_AsCompoundShape(this);
/// <summary>
/// <para>
/// Views this Shape as the DecoratedShape it is, or returns a null handle when it is a different kind -
/// check IsNull(). The same object, not a new reference: never Dispose the result.
/// </para>
/// </summary>
public DecoratedShape AsDecoratedShape() => Jolt.PInvoke.Shape_AsDecoratedShape(this);
/// <summary>
/// <para>
/// Views this Shape as the SphereShape it is, or returns a null handle when it is a different kind - check
/// IsNull(). The same object, not a new reference: never Dispose the result.
/// </para>
/// </summary>
public SphereShape AsSphereShape() => Jolt.PInvoke.Shape_AsSphereShape(this);
/// <summary>
/// <para>
/// Views this Shape as the BoxShape it is, or returns a null handle when it is a different kind - check
/// IsNull(). The same object, not a new reference: never Dispose the result.
/// </para>
/// </summary>
public BoxShape AsBoxShape() => Jolt.PInvoke.Shape_AsBoxShape(this);
/// <summary>
/// <para>
/// Views this Shape as the TriangleShape it is, or returns a null handle when it is a different kind -
/// check IsNull(). The same object, not a new reference: never Dispose the result.
/// </para>
/// </summary>
public TriangleShape AsTriangleShape() => Jolt.PInvoke.Shape_AsTriangleShape(this);
/// <summary>
/// <para>
/// Views this Shape as the CapsuleShape it is, or returns a null handle when it is a different kind - check
/// IsNull(). The same object, not a new reference: never Dispose the result.
/// </para>
/// </summary>
public CapsuleShape AsCapsuleShape() => Jolt.PInvoke.Shape_AsCapsuleShape(this);
/// <summary>
/// <para>
/// Views this Shape as the TaperedCapsuleShape it is, or returns a null handle when it is a different kind
/// - check IsNull(). The same object, not a new reference: never Dispose the result.
/// </para>
/// </summary>
public TaperedCapsuleShape AsTaperedCapsuleShape() => Jolt.PInvoke.Shape_AsTaperedCapsuleShape(this);
/// <summary>
/// <para>
/// Views this Shape as the CylinderShape it is, or returns a null handle when it is a different kind -
/// check IsNull(). The same object, not a new reference: never Dispose the result.
/// </para>
/// </summary>
public CylinderShape AsCylinderShape() => Jolt.PInvoke.Shape_AsCylinderShape(this);
/// <summary>
/// <para>
/// Views this Shape as the TaperedCylinderShape it is, or returns a null handle when it is a different kind
/// - check IsNull(). The same object, not a new reference: never Dispose the result.
/// </para>
/// </summary>
public TaperedCylinderShape AsTaperedCylinderShape() => Jolt.PInvoke.Shape_AsTaperedCylinderShape(this);
/// <summary>
/// <para>
/// Views this Shape as the ConvexHullShape it is, or returns a null handle when it is a different kind -
/// check IsNull(). The same object, not a new reference: never Dispose the result.
/// </para>
/// </summary>
public ConvexHullShape AsConvexHullShape() => Jolt.PInvoke.Shape_AsConvexHullShape(this);
/// <summary>
/// <para>
/// Views this Shape as the StaticCompoundShape it is, or returns a null handle when it is a different kind
/// - check IsNull(). The same object, not a new reference: never Dispose the result.
/// </para>
/// </summary>
public StaticCompoundShape AsStaticCompoundShape() => Jolt.PInvoke.Shape_AsStaticCompoundShape(this);
/// <summary>
/// <para>
/// Views this Shape as the MutableCompoundShape it is, or returns a null handle when it is a different kind
/// - check IsNull(). The same object, not a new reference: never Dispose the result.
/// </para>
/// </summary>
public MutableCompoundShape AsMutableCompoundShape() => Jolt.PInvoke.Shape_AsMutableCompoundShape(this);
/// <summary>
/// <para>
/// Views this Shape as the RotatedTranslatedShape it is, or returns a null handle when it is a different
/// kind - check IsNull(). The same object, not a new reference: never Dispose the result.
/// </para>
/// </summary>
public RotatedTranslatedShape AsRotatedTranslatedShape() => Jolt.PInvoke.Shape_AsRotatedTranslatedShape(this);
/// <summary>
/// <para>
/// Views this Shape as the ScaledShape it is, or returns a null handle when it is a different kind - check
/// IsNull(). The same object, not a new reference: never Dispose the result.
/// </para>
/// </summary>
public ScaledShape AsScaledShape() => Jolt.PInvoke.Shape_AsScaledShape(this);
/// <summary>
/// <para>
/// Views this Shape as the OffsetCenterOfMassShape it is, or returns a null handle when it is a different
/// kind - check IsNull(). The same object, not a new reference: never Dispose the result.
/// </para>
/// </summary>
public OffsetCenterOfMassShape AsOffsetCenterOfMassShape() =>
Jolt.PInvoke.Shape_AsOffsetCenterOfMassShape(this);
/// <summary>
/// <para>
/// Views this Shape as the MeshShape it is, or returns a null handle when it is a different kind - check
/// IsNull(). The same object, not a new reference: never Dispose the result.
/// </para>
/// </summary>
public MeshShape AsMeshShape() => Jolt.PInvoke.Shape_AsMeshShape(this);
/// <summary>
/// <para>
/// Views this Shape as the HeightFieldShape it is, or returns a null handle when it is a different kind -
/// check IsNull(). The same object, not a new reference: never Dispose the result.
/// </para>
/// </summary>
public HeightFieldShape AsHeightFieldShape() => Jolt.PInvoke.Shape_AsHeightFieldShape(this);
/// <summary>
/// <para>
/// Views this Shape as the SoftBodyShape it is, or returns a null handle when it is a different kind -
/// check IsNull(). The same object, not a new reference: never Dispose the result.
/// </para>
/// </summary>
public SoftBodyShape AsSoftBodyShape() => Jolt.PInvoke.Shape_AsSoftBodyShape(this);
/// <summary>
/// <para>
/// Views this Shape as the PlaneShape it is, or returns a null handle when it is a different kind - check
/// IsNull(). The same object, not a new reference: never Dispose the result.
/// </para>
/// </summary>
public PlaneShape AsPlaneShape() => Jolt.PInvoke.Shape_AsPlaneShape(this);
/// <summary>
/// <para>
/// Views this Shape as the EmptyShape it is, or returns a null handle when it is a different kind - check
/// IsNull(). The same object, not a new reference: never Dispose the result.
/// </para>
/// </summary>
public EmptyShape AsEmptyShape() => Jolt.PInvoke.Shape_AsEmptyShape(this);
/// <summary>
/// <para>
/// This is the minimum amount of triangles that should be requested through GetTrianglesNext.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L350">Jolt/Physics/Collision/Shape/Shape.h:350</see>
/// <br/>
/// <c>static constexpr int cGetTrianglesMinTrianglesRequested = 32</c>
/// </para>
/// </summary>
public static int GetGetTrianglesMinTrianglesRequested() =>
Jolt.PInvoke.Shape_GetGetTrianglesMinTrianglesRequested();
/// <summary>
/// <para>
/// Debug helper which draws the intersection between water and the shapes, the center of buoyancy and the
/// submerged volume
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L449">Jolt/Physics/Collision/Shape/Shape.h:449</see>
/// <br/>
/// <c>static bool sDrawSubmergedVolumes</c>
/// </para>
/// </summary>
public static bool GetDrawSubmergedVolumes() => Jolt.PInvoke.Shape_GetDrawSubmergedVolumes();
/// <summary>
/// <para>
/// Debug helper which draws the intersection between water and the shapes, the center of buoyancy and the
/// submerged volume
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Collision/Shape/Shape.h#L449">Jolt/Physics/Collision/Shape/Shape.h:449</see>
/// <br/>
/// <c>static bool sDrawSubmergedVolumes</c>
/// </para>
/// </summary>
public static void SetDrawSubmergedVolumes(bool value) => Jolt.PInvoke.Shape_SetDrawSubmergedVolumes(value);
public void AddRef() => Jolt.PInvoke.Shape_AddRef(this);
public void Release() => Jolt.PInvoke.Shape_Release(this);
public uint GetRefCount() => Jolt.PInvoke.Shape_GetRefCount(this);
public void Dispose()
{
if (IsNull())
return;
Release();
}
}
}