//
// 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
{
///
///
/// An interface to query which vertices of a soft body are colliding with other bodies
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyManifold.h:12
///
/// class SoftBodyManifold
///
///
[InteropHandle]
public readonly partial struct SoftBodyManifold
{
///
///
/// Get the vertices of the soft body for iterating
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyManifold.h:16
///
/// const Array<SoftBodyVertex> & GetVertices() const
///
///
///
///
/// The span is a view of the container's own storage, not a copy, so it costs nothing to take. It's only
/// valid until that container is resized or its owner is destroyed.
///
///
[return: Brutal.Attributes.Fixed]
public unsafe ReadOnlySpan GetVertices()
{
Jolt.PInvoke.SoftBodyManifold_GetVertices(this, out var _outResult);
return new ReadOnlySpan((void*)_outResult.Data, checked((int)_outResult.Count));
}
///
///
/// Check if a vertex has collided with something in this update
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyManifold.h:19
///
/// bool HasContact(const SoftBodyVertex &inVertex) const
///
///
public bool HasContact(in SoftBodyVertex vertex) => Jolt.PInvoke.SoftBodyManifold_HasContact(this, in vertex);
///
///
/// Get the local space contact point (multiply by GetCenterOfMassTransform() of the soft body to get world
/// space)
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyManifold.h:25
///
/// Vec3 GetLocalContactPoint(const SoftBodyVertex &inVertex) const
///
///
public float3 GetLocalContactPoint(in SoftBodyVertex vertex) =>
Jolt.PInvoke.SoftBodyManifold_GetLocalContactPoint(this, in vertex);
///
///
/// Get the contact normal for the vertex (assumes there is a contact).
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyManifold.h:31
///
/// Vec3 GetContactNormal(const SoftBodyVertex &inVertex) const
///
///
public float3 GetContactNormal(in SoftBodyVertex vertex) =>
Jolt.PInvoke.SoftBodyManifold_GetContactNormal(this, in vertex);
///
///
/// Get the body with which the vertex has collided in this update
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyManifold.h:37
///
/// BodyID GetContactBodyID(const SoftBodyVertex &inVertex) const
///
///
public uint GetContactBodyID(in SoftBodyVertex vertex) =>
Jolt.PInvoke.SoftBodyManifold_GetContactBodyID(this, in vertex);
///
///
/// Get the number of sensors that are in contact with the soft body
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyManifold.h:51
///
/// uint GetNumSensorContacts() const
///
///
public uint GetNumSensorContacts() => Jolt.PInvoke.SoftBodyManifold_GetNumSensorContacts(this);
///
///
/// Get the i-th sensor that is in contact with the soft body
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyManifold.h:57
///
/// BodyID GetSensorContactBodyID(uint inIndex) const
///
///
public uint GetSensorContactBodyID(uint index)
{
var _result = Jolt.PInvoke.SoftBodyManifold_GetSensorContactBodyID(this, index, out var _inRange);
if (_inRange == 0)
throw new ArgumentOutOfRangeException(
nameof(index),
index,
"Expected an index below the number of sensor contacts."
);
return _result;
}
}
}