mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 20:48:24 +01:00
1841 lines
85 KiB
C#
1841 lines
85 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>
|
|
/// Class that provides operations on bodies using a body ID. Note that if you need to do multiple operations on
|
|
/// a single body, it is more efficient to lock the body once and combine the operations. All quantities are in
|
|
/// world space unless otherwise specified.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L35">Jolt/Physics/Body/BodyInterface.h:35</see>
|
|
/// <br/>
|
|
/// <c>class BodyInterface : public NonCopyable</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[InteropHandle]
|
|
public readonly partial struct BodyInterface
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// Initialize the interface (should only be called by PhysicsSystem)
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L39">Jolt/Physics/Body/BodyInterface.h:39</see>
|
|
/// <br/>
|
|
/// <c>void Init(BodyLockInterface &inBodyLockInterface, BodyManager &inBodyManager, BroadPhase &inBroadPhase)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void Init(BodyLockInterface bodyLockInterface, BodyManager bodyManager, BroadPhase broadPhase) =>
|
|
Jolt.PInvoke.BodyInterface_Init(this, bodyLockInterface, bodyManager, broadPhase);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Create a rigid body
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L43">Jolt/Physics/Body/BodyInterface.h:43</see>
|
|
/// <br/>
|
|
/// <c>Body * CreateBody(const BodyCreationSettings &inSettings)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Create a rigid body
|
|
/// @return Created body or null when out of bodies
|
|
/// </code>
|
|
/// <para>
|
|
/// The returned handle is borrowed from its owner; don't Dispose it.
|
|
/// </para>
|
|
/// </remarks>
|
|
public Body CreateBody(BodyCreationSettings settings) => Jolt.PInvoke.BodyInterface_CreateBody(this, settings);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Create a soft body
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L47">Jolt/Physics/Body/BodyInterface.h:47</see>
|
|
/// <br/>
|
|
/// <c>Body * CreateSoftBody(const SoftBodyCreationSettings &inSettings)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Create a soft body
|
|
/// @return Created body or null when out of bodies
|
|
/// </code>
|
|
/// <para>
|
|
/// The returned handle is borrowed from its owner; don't Dispose it.
|
|
/// </para>
|
|
/// </remarks>
|
|
public Body CreateSoftBody(SoftBodyCreationSettings settings) =>
|
|
Jolt.PInvoke.BodyInterface_CreateSoftBody(this, settings);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Create a rigid body with specified ID. This function can be used if a simulation is to run in sync
|
|
/// between clients or if a simulation needs to be restored exactly. The ID created on the server can be
|
|
/// replicated to the client and used to create a deterministic simulation.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L52">Jolt/Physics/Body/BodyInterface.h:52</see>
|
|
/// <br/>
|
|
/// <c>Body * CreateBodyWithID(const BodyID &inBodyID, const BodyCreationSettings &inSettings)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Create a rigid body with specified ID. This function can be used if a simulation is to run in sync between clients or if a simulation needs to be restored exactly.
|
|
/// The ID created on the server can be replicated to the client and used to create a deterministic simulation.
|
|
/// @return Created body or null when the body ID is invalid or a body of the same ID already exists.
|
|
/// </code>
|
|
/// <para>
|
|
/// The returned handle is borrowed from its owner; don't Dispose it.
|
|
/// </para>
|
|
/// </remarks>
|
|
public Body CreateBodyWithID(uint bodyID, BodyCreationSettings settings) =>
|
|
Jolt.PInvoke.BodyInterface_CreateBodyWithID(this, bodyID, settings);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Create a soft body with specified ID. See comments at CreateBodyWithID.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L55">Jolt/Physics/Body/BodyInterface.h:55</see>
|
|
/// <br/>
|
|
/// <c>Body * CreateSoftBodyWithID(const BodyID &inBodyID, const SoftBodyCreationSettings &inSettings)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// The returned handle is borrowed from its owner; don't Dispose it.
|
|
/// </para>
|
|
/// </remarks>
|
|
public Body CreateSoftBodyWithID(uint bodyID, SoftBodyCreationSettings settings) =>
|
|
Jolt.PInvoke.BodyInterface_CreateSoftBodyWithID(this, bodyID, settings);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Advanced use only. Creates a rigid body without specifying an ID. This body cannot be added to the
|
|
/// physics system until it has been assigned a body ID. This can be used to decouple allocation from
|
|
/// registering the body. A call to CreateBodyWithoutID followed by AssignBodyID is equivalent to calling
|
|
/// CreateBodyWithID.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L60">Jolt/Physics/Body/BodyInterface.h:60</see>
|
|
/// <br/>
|
|
/// <c>Body * CreateBodyWithoutID(const BodyCreationSettings &inSettings) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Advanced use only. Creates a rigid body without specifying an ID. This body cannot be added to the physics system until it has been assigned a body ID.
|
|
/// This can be used to decouple allocation from registering the body. A call to CreateBodyWithoutID followed by AssignBodyID is equivalent to calling CreateBodyWithID.
|
|
/// @return Created body
|
|
/// </code>
|
|
/// <para>
|
|
/// The returned handle is borrowed from its owner; don't Dispose it.
|
|
/// </para>
|
|
/// </remarks>
|
|
public Body CreateBodyWithoutID(BodyCreationSettings settings) =>
|
|
Jolt.PInvoke.BodyInterface_CreateBodyWithoutID(this, settings);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Advanced use only. Creates a body without specifying an ID. See comments at CreateBodyWithoutID.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L63">Jolt/Physics/Body/BodyInterface.h:63</see>
|
|
/// <br/>
|
|
/// <c>Body * CreateSoftBodyWithoutID(const SoftBodyCreationSettings &inSettings) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// The returned handle is borrowed from its owner; don't Dispose it.
|
|
/// </para>
|
|
/// </remarks>
|
|
public Body CreateSoftBodyWithoutID(SoftBodyCreationSettings settings) =>
|
|
Jolt.PInvoke.BodyInterface_CreateSoftBodyWithoutID(this, settings);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Advanced use only. Destroy a body previously created with CreateBodyWithoutID that hasn't gotten an ID
|
|
/// yet through the AssignBodyID function, or a body that has had its body ID unassigned through
|
|
/// UnassignBodyIDs. Bodies that have an ID should be destroyed through DestroyBody.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L67">Jolt/Physics/Body/BodyInterface.h:67</see>
|
|
/// <br/>
|
|
/// <c>void DestroyBodyWithoutID(Body *inBody) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void DestroyBodyWithoutID(Body body) => Jolt.PInvoke.BodyInterface_DestroyBodyWithoutID(this, body);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Advanced use only. Assigns the next available body ID to a body that was created using
|
|
/// CreateBodyWithoutID. After this call, the body can be added to the physics system.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L71">Jolt/Physics/Body/BodyInterface.h:71</see>
|
|
/// <br/>
|
|
/// <c>bool AssignBodyID(Body *ioBody)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Advanced use only. Assigns the next available body ID to a body that was created using CreateBodyWithoutID. After this call, the body can be added to the physics system.
|
|
/// @return false if the body already has an ID or out of body ids.
|
|
/// </code>
|
|
/// </remarks>
|
|
public bool AssignBodyID(Body body) => Jolt.PInvoke.BodyInterface_AssignBodyID(this, body);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Advanced use only. Assigns a body ID to a body that was created using CreateBodyWithoutID. After this
|
|
/// call, the body can be added to the physics system.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L75">Jolt/Physics/Body/BodyInterface.h:75</see>
|
|
/// <br/>
|
|
/// <c>bool AssignBodyID(Body *ioBody, const BodyID &inBodyID)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Advanced use only. Assigns a body ID to a body that was created using CreateBodyWithoutID. After this call, the body can be added to the physics system.
|
|
/// @return false if the body already has an ID or if the ID is not valid.
|
|
/// </code>
|
|
/// </remarks>
|
|
public bool AssignBodyID(Body body, uint bodyID) =>
|
|
Jolt.PInvoke.BodyInterface_AssignBodyID_2(this, body, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Advanced use only. See UnassignBodyIDs. Unassigns the ID of a single body.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L78">Jolt/Physics/Body/BodyInterface.h:78</see>
|
|
/// <br/>
|
|
/// <c>Body * UnassignBodyID(const BodyID &inBodyID)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// The returned handle is borrowed from its owner; don't Dispose it.
|
|
/// </para>
|
|
/// </remarks>
|
|
public Body UnassignBodyID(uint bodyID) => Jolt.PInvoke.BodyInterface_UnassignBodyID(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Advanced use only. Removes a number of body IDs from their bodies and returns the body pointers. Before
|
|
/// calling this, the body should have been removed from the physics system. The body can be destroyed
|
|
/// through DestroyBodyWithoutID. This can be used to decouple deallocation. A call to UnassignBodyIDs
|
|
/// followed by calls to DestroyBodyWithoutID is equivalent to calling DestroyBodies.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L85">Jolt/Physics/Body/BodyInterface.h:85</see>
|
|
/// <br/>
|
|
/// <c>void UnassignBodyIDs(const BodyID *inBodyIDs, int inNumber, Body **outBodies)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Advanced use only. Removes a number of body IDs from their bodies and returns the body pointers. Before calling this, the body should have been removed from the physics system.
|
|
/// The body can be destroyed through DestroyBodyWithoutID. This can be used to decouple deallocation. A call to UnassignBodyIDs followed by calls to DestroyBodyWithoutID is equivalent to calling DestroyBodies.
|
|
/// @param inBodyIDs A list of body IDs
|
|
/// @param inNumber Number of bodies in the list
|
|
/// @param outBodies If not null on input, this will contain a list of body pointers corresponding to inBodyIDs that can be destroyed afterwards (caller assumes ownership over these).
|
|
/// </code>
|
|
/// <para>
|
|
/// bodyIDs 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>
|
|
/// <para>
|
|
/// bodies is a buffer of Body handles you allocate and size, read by the call.
|
|
/// </para>
|
|
/// </remarks>
|
|
public unsafe void UnassignBodyIDs(ReadOnlySpan<uint> bodyIDs, Ptr<Body> bodies)
|
|
{
|
|
fixed (uint* bodyIDs_fixed = bodyIDs)
|
|
{
|
|
Jolt.PInvoke.BodyInterface_UnassignBodyIDs(this, bodyIDs_fixed, (int)bodyIDs.Length, bodies);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Destroy a body. Make sure that you remove the body from the physics system using
|
|
/// BodyInterface::RemoveBody before calling this function.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L89">Jolt/Physics/Body/BodyInterface.h:89</see>
|
|
/// <br/>
|
|
/// <c>void DestroyBody(const BodyID &inBodyID)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void DestroyBody(uint bodyID) => Jolt.PInvoke.BodyInterface_DestroyBody(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Destroy multiple bodies Make sure that you remove the bodies from the physics system using
|
|
/// BodyInterface::RemoveBody before calling this function.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L93">Jolt/Physics/Body/BodyInterface.h:93</see>
|
|
/// <br/>
|
|
/// <c>void DestroyBodies(const BodyID *inBodyIDs, int inNumber)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// bodyIDs 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 DestroyBodies(ReadOnlySpan<uint> bodyIDs)
|
|
{
|
|
fixed (uint* bodyIDs_fixed = bodyIDs)
|
|
{
|
|
Jolt.PInvoke.BodyInterface_DestroyBodies(this, bodyIDs_fixed, (int)bodyIDs.Length);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Add body to the physics system. Note that if you need to add multiple bodies, use the
|
|
/// AddBodiesPrepare/AddBodiesFinalize function. Adding many bodies, one at a time, results in a really
|
|
/// inefficient broadphase until PhysicsSystem::OptimizeBroadPhase is called or when PhysicsSystem::Update
|
|
/// rebuilds the tree! After adding, to get a body by ID use the BodyLockRead or BodyLockWrite interface!
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L99">Jolt/Physics/Body/BodyInterface.h:99</see>
|
|
/// <br/>
|
|
/// <c>void AddBody(const BodyID &inBodyID, EActivation inActivationMode)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void AddBody(uint bodyID, Activation activationMode) =>
|
|
Jolt.PInvoke.BodyInterface_AddBody(this, bodyID, activationMode);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Remove body from the physics system. Note that you need to add a body to the physics system before you
|
|
/// can remove it.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L102">Jolt/Physics/Body/BodyInterface.h:102</see>
|
|
/// <br/>
|
|
/// <c>void RemoveBody(const BodyID &inBodyID)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void RemoveBody(uint bodyID) => Jolt.PInvoke.BodyInterface_RemoveBody(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Check if a body has been added to the physics system.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L105">Jolt/Physics/Body/BodyInterface.h:105</see>
|
|
/// <br/>
|
|
/// <c>bool IsAdded(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public bool IsAdded(uint bodyID) => Jolt.PInvoke.BodyInterface_IsAdded(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Combines CreateBody and AddBody
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L109">Jolt/Physics/Body/BodyInterface.h:109</see>
|
|
/// <br/>
|
|
/// <c>BodyID CreateAndAddBody(const BodyCreationSettings &inSettings, EActivation inActivationMode)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Combines CreateBody and AddBody
|
|
/// @return Created body ID or an invalid ID when out of bodies
|
|
/// </code>
|
|
/// </remarks>
|
|
public uint CreateAndAddBody(BodyCreationSettings settings, Activation activationMode) =>
|
|
Jolt.PInvoke.BodyInterface_CreateAndAddBody(this, settings, activationMode);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Combines CreateSoftBody and AddBody
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L113">Jolt/Physics/Body/BodyInterface.h:113</see>
|
|
/// <br/>
|
|
/// <c>BodyID CreateAndAddSoftBody(const SoftBodyCreationSettings &inSettings, EActivation inActivationMode)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Combines CreateSoftBody and AddBody
|
|
/// @return Created body ID or an invalid ID when out of bodies
|
|
/// </code>
|
|
/// </remarks>
|
|
public uint CreateAndAddSoftBody(SoftBodyCreationSettings settings, Activation activationMode) =>
|
|
Jolt.PInvoke.BodyInterface_CreateAndAddSoftBody(this, settings, activationMode);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Remove inNumber bodies in ioBodies from the PhysicsSystem. Note that bodies need to be added to the
|
|
/// physics system before they can be removed. ioBodies may be shuffled around by this function.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L137">Jolt/Physics/Body/BodyInterface.h:137</see>
|
|
/// <br/>
|
|
/// <c>void RemoveBodies(BodyID *ioBodies, int inNumber)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// bodies is the buffer the native call works on, and its element count travels with it: the call may write
|
|
/// through the span, and only for the duration of the call.
|
|
/// </para>
|
|
/// </remarks>
|
|
public unsafe void RemoveBodies(Span<uint> bodies)
|
|
{
|
|
fixed (uint* bodies_fixed = bodies)
|
|
{
|
|
Jolt.PInvoke.BodyInterface_RemoveBodies(this, bodies_fixed, (int)bodies.Length);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L142">Jolt/Physics/Body/BodyInterface.h:142</see>
|
|
/// <br/>
|
|
/// <c>void ActivateBody(const BodyID &inBodyID)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// @name Activate / deactivate a body. Note that you need to add a body to the physics system before you can activate it.
|
|
/// @{
|
|
/// </code>
|
|
/// </remarks>
|
|
public void ActivateBody(uint bodyID) => Jolt.PInvoke.BodyInterface_ActivateBody(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L143">Jolt/Physics/Body/BodyInterface.h:143</see>
|
|
/// <br/>
|
|
/// <c>void ActivateBodies(const BodyID *inBodyIDs, int inNumber)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// bodyIDs 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 ActivateBodies(ReadOnlySpan<uint> bodyIDs)
|
|
{
|
|
fixed (uint* bodyIDs_fixed = bodyIDs)
|
|
{
|
|
Jolt.PInvoke.BodyInterface_ActivateBodies(this, bodyIDs_fixed, (int)bodyIDs.Length);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L144">Jolt/Physics/Body/BodyInterface.h:144</see>
|
|
/// <br/>
|
|
/// <c>void ActivateBodiesInAABox(const AABox &inBox, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Pass default for broadPhaseLayerFilter to filter nothing out.
|
|
/// </para>
|
|
/// <para>
|
|
/// Pass default for objectLayerFilter to filter nothing out.
|
|
/// </para>
|
|
/// </remarks>
|
|
public void ActivateBodiesInAABox(
|
|
in AABox box,
|
|
BroadPhaseLayerFilter broadPhaseLayerFilter,
|
|
ObjectLayerFilter objectLayerFilter
|
|
) => Jolt.PInvoke.BodyInterface_ActivateBodiesInAABox(this, in box, broadPhaseLayerFilter, objectLayerFilter);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L145">Jolt/Physics/Body/BodyInterface.h:145</see>
|
|
/// <br/>
|
|
/// <c>void DeactivateBody(const BodyID &inBodyID)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void DeactivateBody(uint bodyID) => Jolt.PInvoke.BodyInterface_DeactivateBody(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L146">Jolt/Physics/Body/BodyInterface.h:146</see>
|
|
/// <br/>
|
|
/// <c>void DeactivateBodies(const BodyID *inBodyIDs, int inNumber)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// bodyIDs 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 DeactivateBodies(ReadOnlySpan<uint> bodyIDs)
|
|
{
|
|
fixed (uint* bodyIDs_fixed = bodyIDs)
|
|
{
|
|
Jolt.PInvoke.BodyInterface_DeactivateBodies(this, bodyIDs_fixed, (int)bodyIDs.Length);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Checks if a body is currently actively simulating
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L147">Jolt/Physics/Body/BodyInterface.h:147</see>
|
|
/// <br/>
|
|
/// <c>bool IsActive(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public bool IsActive(uint bodyID) => Jolt.PInvoke.BodyInterface_IsActive(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::ResetSleepTimer
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L148">Jolt/Physics/Body/BodyInterface.h:148</see>
|
|
/// <br/>
|
|
/// <c>void ResetSleepTimer(const BodyID &inBodyID)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void ResetSleepTimer(uint bodyID) => Jolt.PInvoke.BodyInterface_ResetSleepTimer(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Create a two body constraint
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L152">Jolt/Physics/Body/BodyInterface.h:152</see>
|
|
/// <br/>
|
|
/// <c>TwoBodyConstraint * CreateConstraint(const TwoBodyConstraintSettings *inSettings, const BodyID &inBodyID1, const BodyID &inBodyID2)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// The returned handle carries its own reference; Dispose it once when you're done.
|
|
/// </para>
|
|
/// </remarks>
|
|
public TwoBodyConstraint CreateConstraint(TwoBodyConstraintSettings settings, uint bodyID1, uint bodyID2) =>
|
|
Jolt.PInvoke.BodyInterface_CreateConstraint(this, settings, bodyID1, bodyID2);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Activate non-static bodies attached to a constraint. Note that the bodies involved in the constraint
|
|
/// should be added to the physics system before activating a constraint.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L156">Jolt/Physics/Body/BodyInterface.h:156</see>
|
|
/// <br/>
|
|
/// <c>void ActivateConstraint(const TwoBodyConstraint *inConstraint)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void ActivateConstraint(TwoBodyConstraint constraint) =>
|
|
Jolt.PInvoke.BodyInterface_ActivateConstraint(this, constraint);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get the current shape
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L162">Jolt/Physics/Body/BodyInterface.h:162</see>
|
|
/// <br/>
|
|
/// <c>RefConst<Shape> GetShape(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// The returned handle carries its own reference; Dispose it once when you're done.
|
|
/// </para>
|
|
/// </remarks>
|
|
public Shape GetShape(uint bodyID) => Jolt.PInvoke.BodyInterface_GetShape(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Set a new shape on the body
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L169">Jolt/Physics/Body/BodyInterface.h:169</see>
|
|
/// <br/>
|
|
/// <c>void SetShape(const BodyID &inBodyID, const Shape *inShape, bool inUpdateMassProperties, EActivation inActivationMode) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Set a new shape on the body
|
|
/// @param inBodyID Body ID of body that had its shape changed
|
|
/// @param inShape The new shape
|
|
/// @param inUpdateMassProperties When true, the mass and inertia tensor is recalculated
|
|
/// @param inActivationMode Whether or not to activate the body
|
|
/// </code>
|
|
/// </remarks>
|
|
public void SetShape(uint bodyID, Shape shape, bool updateMassProperties, Activation activationMode) =>
|
|
Jolt.PInvoke.BodyInterface_SetShape(this, bodyID, shape, updateMassProperties, activationMode);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Notify all systems to indicate that a shape has changed (usable for MutableCompoundShapes)
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L176">Jolt/Physics/Body/BodyInterface.h:176</see>
|
|
/// <br/>
|
|
/// <c>void NotifyShapeChanged(const BodyID &inBodyID, Vec3Arg inPreviousCenterOfMass, bool inUpdateMassProperties, EActivation inActivationMode) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Notify all systems to indicate that a shape has changed (usable for MutableCompoundShapes)
|
|
/// @param inBodyID Body ID of body that had its shape changed
|
|
/// @param inPreviousCenterOfMass Center of mass of the shape before the alterations
|
|
/// @param inUpdateMassProperties When true, the mass and inertia tensor is recalculated
|
|
/// @param inActivationMode Whether or not to activate the body
|
|
/// </code>
|
|
/// </remarks>
|
|
public void NotifyShapeChanged(
|
|
uint bodyID,
|
|
float3 previousCenterOfMass,
|
|
bool updateMassProperties,
|
|
Activation activationMode
|
|
) =>
|
|
Jolt.PInvoke.BodyInterface_NotifyShapeChanged(
|
|
this,
|
|
bodyID,
|
|
previousCenterOfMass,
|
|
updateMassProperties,
|
|
activationMode
|
|
);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// The collision layer this body belongs to (determines if two objects can collide)
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L181">Jolt/Physics/Body/BodyInterface.h:181</see>
|
|
/// <br/>
|
|
/// <c>void SetObjectLayer(const BodyID &inBodyID, ObjectLayer inLayer)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// @name Object layer of a body
|
|
/// @{
|
|
/// </code>
|
|
/// </remarks>
|
|
public void SetObjectLayer(uint bodyID, ushort layer) =>
|
|
Jolt.PInvoke.BodyInterface_SetObjectLayer(this, bodyID, layer);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::GetObjectLayer
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L182">Jolt/Physics/Body/BodyInterface.h:182</see>
|
|
/// <br/>
|
|
/// <c>ObjectLayer GetObjectLayer(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public ushort GetObjectLayer(uint bodyID) => Jolt.PInvoke.BodyInterface_GetObjectLayer(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L187">Jolt/Physics/Body/BodyInterface.h:187</see>
|
|
/// <br/>
|
|
/// <c>void SetPositionAndRotation(const BodyID &inBodyID, RVec3Arg inPosition, QuatArg inRotation, EActivation inActivationMode)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// @name Position and rotation of a body
|
|
/// @{
|
|
/// </code>
|
|
/// </remarks>
|
|
public void SetPositionAndRotation(
|
|
uint bodyID,
|
|
float3 position,
|
|
floatQuat rotation,
|
|
Activation activationMode
|
|
) => Jolt.PInvoke.BodyInterface_SetPositionAndRotation(this, bodyID, position, rotation, activationMode);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Will only update the position/rotation and activate the body when the difference is larger than a very
|
|
/// small number. This avoids updating the broadphase/waking up a body when the resulting
|
|
/// position/orientation doesn't really change.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L188">Jolt/Physics/Body/BodyInterface.h:188</see>
|
|
/// <br/>
|
|
/// <c>void SetPositionAndRotationWhenChanged(const BodyID &inBodyID, RVec3Arg inPosition, QuatArg inRotation, EActivation inActivationMode)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetPositionAndRotationWhenChanged(
|
|
uint bodyID,
|
|
float3 position,
|
|
floatQuat rotation,
|
|
Activation activationMode
|
|
) =>
|
|
Jolt.PInvoke.BodyInterface_SetPositionAndRotationWhenChanged(
|
|
this,
|
|
bodyID,
|
|
position,
|
|
rotation,
|
|
activationMode
|
|
);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L189">Jolt/Physics/Body/BodyInterface.h:189</see>
|
|
/// <br/>
|
|
/// <c>void GetPositionAndRotation(const BodyID &inBodyID, RVec3 &outPosition, Quat &outRotation) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void GetPositionAndRotation(uint bodyID, out float3 position, out floatQuat rotation) =>
|
|
Jolt.PInvoke.BodyInterface_GetPositionAndRotation(this, bodyID, out position, out rotation);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L190">Jolt/Physics/Body/BodyInterface.h:190</see>
|
|
/// <br/>
|
|
/// <c>void SetPosition(const BodyID &inBodyID, RVec3Arg inPosition, EActivation inActivationMode)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetPosition(uint bodyID, float3 position, Activation activationMode) =>
|
|
Jolt.PInvoke.BodyInterface_SetPosition(this, bodyID, position, activationMode);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L191">Jolt/Physics/Body/BodyInterface.h:191</see>
|
|
/// <br/>
|
|
/// <c>RVec3 GetPosition(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float3 GetPosition(uint bodyID) => Jolt.PInvoke.BodyInterface_GetPosition(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::GetCenterOfMassPosition
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L192">Jolt/Physics/Body/BodyInterface.h:192</see>
|
|
/// <br/>
|
|
/// <c>RVec3 GetCenterOfMassPosition(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float3 GetCenterOfMassPosition(uint bodyID) =>
|
|
Jolt.PInvoke.BodyInterface_GetCenterOfMassPosition(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L193">Jolt/Physics/Body/BodyInterface.h:193</see>
|
|
/// <br/>
|
|
/// <c>void SetRotation(const BodyID &inBodyID, QuatArg inRotation, EActivation inActivationMode)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetRotation(uint bodyID, floatQuat rotation, Activation activationMode) =>
|
|
Jolt.PInvoke.BodyInterface_SetRotation(this, bodyID, rotation, activationMode);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L194">Jolt/Physics/Body/BodyInterface.h:194</see>
|
|
/// <br/>
|
|
/// <c>Quat GetRotation(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public floatQuat GetRotation(uint bodyID) => Jolt.PInvoke.BodyInterface_GetRotation(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::GetWorldTransform
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L195">Jolt/Physics/Body/BodyInterface.h:195</see>
|
|
/// <br/>
|
|
/// <c>RMat44 GetWorldTransform(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float4x4 GetWorldTransform(uint bodyID) => Jolt.PInvoke.BodyInterface_GetWorldTransform(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::GetCenterOfMassTransform
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L196">Jolt/Physics/Body/BodyInterface.h:196</see>
|
|
/// <br/>
|
|
/// <c>RMat44 GetCenterOfMassTransform(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float4x4 GetCenterOfMassTransform(uint bodyID) =>
|
|
Jolt.PInvoke.BodyInterface_GetCenterOfMassTransform(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Set velocity of body such that it will be positioned at inTargetPosition/Rotation in inDeltaTime seconds
|
|
/// (will activate body if needed)
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L200">Jolt/Physics/Body/BodyInterface.h:200</see>
|
|
/// <br/>
|
|
/// <c>void MoveKinematic(const BodyID &inBodyID, RVec3Arg inTargetPosition, QuatArg inTargetRotation, float inDeltaTime)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void MoveKinematic(uint bodyID, float3 targetPosition, floatQuat targetRotation, float deltaTime) =>
|
|
Jolt.PInvoke.BodyInterface_MoveKinematic(this, bodyID, targetPosition, targetRotation, deltaTime);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Linear or angular velocity (functions will activate body if needed). Note that the linear velocity is
|
|
/// the velocity of the center of mass, which may not coincide with the position of your object, to correct
|
|
/// for this: \f$VelocityCOM = Velocity - AngularVelocity \times ShapeCOM\f$
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L204">Jolt/Physics/Body/BodyInterface.h:204</see>
|
|
/// <br/>
|
|
/// <c>void SetLinearAndAngularVelocity(const BodyID &inBodyID, Vec3Arg inLinearVelocity, Vec3Arg inAngularVelocity)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetLinearAndAngularVelocity(uint bodyID, float3 linearVelocity, float3 angularVelocity) =>
|
|
Jolt.PInvoke.BodyInterface_SetLinearAndAngularVelocity(this, bodyID, linearVelocity, angularVelocity);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L205">Jolt/Physics/Body/BodyInterface.h:205</see>
|
|
/// <br/>
|
|
/// <c>void GetLinearAndAngularVelocity(const BodyID &inBodyID, Vec3 &outLinearVelocity, Vec3 &outAngularVelocity) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void GetLinearAndAngularVelocity(uint bodyID, out float3 linearVelocity, out float3 angularVelocity) =>
|
|
Jolt.PInvoke.BodyInterface_GetLinearAndAngularVelocity(
|
|
this,
|
|
bodyID,
|
|
out linearVelocity,
|
|
out angularVelocity
|
|
);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::SetLinearVelocity
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L206">Jolt/Physics/Body/BodyInterface.h:206</see>
|
|
/// <br/>
|
|
/// <c>void SetLinearVelocity(const BodyID &inBodyID, Vec3Arg inLinearVelocity)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetLinearVelocity(uint bodyID, float3 linearVelocity) =>
|
|
Jolt.PInvoke.BodyInterface_SetLinearVelocity(this, bodyID, linearVelocity);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::GetLinearVelocity
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L207">Jolt/Physics/Body/BodyInterface.h:207</see>
|
|
/// <br/>
|
|
/// <c>Vec3 GetLinearVelocity(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float3 GetLinearVelocity(uint bodyID) => Jolt.PInvoke.BodyInterface_GetLinearVelocity(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Add velocity to current velocity
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L208">Jolt/Physics/Body/BodyInterface.h:208</see>
|
|
/// <br/>
|
|
/// <c>void AddLinearVelocity(const BodyID &inBodyID, Vec3Arg inLinearVelocity)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void AddLinearVelocity(uint bodyID, float3 linearVelocity) =>
|
|
Jolt.PInvoke.BodyInterface_AddLinearVelocity(this, bodyID, linearVelocity);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Add linear and angular to current velocities
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L209">Jolt/Physics/Body/BodyInterface.h:209</see>
|
|
/// <br/>
|
|
/// <c>void AddLinearAndAngularVelocity(const BodyID &inBodyID, Vec3Arg inLinearVelocity, Vec3Arg inAngularVelocity)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void AddLinearAndAngularVelocity(uint bodyID, float3 linearVelocity, float3 angularVelocity) =>
|
|
Jolt.PInvoke.BodyInterface_AddLinearAndAngularVelocity(this, bodyID, linearVelocity, angularVelocity);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::SetAngularVelocity
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L210">Jolt/Physics/Body/BodyInterface.h:210</see>
|
|
/// <br/>
|
|
/// <c>void SetAngularVelocity(const BodyID &inBodyID, Vec3Arg inAngularVelocity)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetAngularVelocity(uint bodyID, float3 angularVelocity) =>
|
|
Jolt.PInvoke.BodyInterface_SetAngularVelocity(this, bodyID, angularVelocity);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::GetAngularVelocity
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L211">Jolt/Physics/Body/BodyInterface.h:211</see>
|
|
/// <br/>
|
|
/// <c>Vec3 GetAngularVelocity(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float3 GetAngularVelocity(uint bodyID) => Jolt.PInvoke.BodyInterface_GetAngularVelocity(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Velocity of point inPoint (in world space, e.g. on the surface of the body) of the body. @see
|
|
/// Body::GetPointVelocity
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L212">Jolt/Physics/Body/BodyInterface.h:212</see>
|
|
/// <br/>
|
|
/// <c>Vec3 GetPointVelocity(const BodyID &inBodyID, RVec3Arg inPoint) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float3 GetPointVelocity(uint bodyID, float3 point) =>
|
|
Jolt.PInvoke.BodyInterface_GetPointVelocity(this, bodyID, point);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Set the complete motion state of a body. Note that the linear velocity is the velocity of the center of
|
|
/// mass, which may not coincide with the position of your object, to correct for this: \f$VelocityCOM =
|
|
/// Velocity - AngularVelocity \times ShapeCOM\f$
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L216">Jolt/Physics/Body/BodyInterface.h:216</see>
|
|
/// <br/>
|
|
/// <c>void SetPositionRotationAndVelocity(const BodyID &inBodyID, RVec3Arg inPosition, QuatArg inRotation, Vec3Arg inLinearVelocity, Vec3Arg inAngularVelocity)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetPositionRotationAndVelocity(
|
|
uint bodyID,
|
|
float3 position,
|
|
floatQuat rotation,
|
|
float3 linearVelocity,
|
|
float3 angularVelocity
|
|
) =>
|
|
Jolt.PInvoke.BodyInterface_SetPositionRotationAndVelocity(
|
|
this,
|
|
bodyID,
|
|
position,
|
|
rotation,
|
|
linearVelocity,
|
|
angularVelocity
|
|
);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::AddForce
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L220">Jolt/Physics/Body/BodyInterface.h:220</see>
|
|
/// <br/>
|
|
/// <c>void AddForce(const BodyID &inBodyID, Vec3Arg inForce, EActivation inActivationMode = EActivation::Activate)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// @name Add forces to the body. Note that you should add a body to the physics system before applying forces or torques.
|
|
/// @{
|
|
/// </code>
|
|
/// </remarks>
|
|
public void AddForce(uint bodyID, float3 force, Activation activationMode = Activation.Activate) =>
|
|
Jolt.PInvoke.BodyInterface_AddForce(this, bodyID, force, activationMode);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Applied at world space position inPoint. @see Body::AddForce
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L221">Jolt/Physics/Body/BodyInterface.h:221</see>
|
|
/// <br/>
|
|
/// <c>void AddForce(const BodyID &inBodyID, Vec3Arg inForce, RVec3Arg inPoint, EActivation inActivationMode = EActivation::Activate)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void AddForce(
|
|
uint bodyID,
|
|
float3 force,
|
|
float3 point,
|
|
Activation activationMode = Activation.Activate
|
|
) => Jolt.PInvoke.BodyInterface_AddForce_2(this, bodyID, force, point, activationMode);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::AddTorque
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L222">Jolt/Physics/Body/BodyInterface.h:222</see>
|
|
/// <br/>
|
|
/// <c>void AddTorque(const BodyID &inBodyID, Vec3Arg inTorque, EActivation inActivationMode = EActivation::Activate)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void AddTorque(uint bodyID, float3 torque, Activation activationMode = Activation.Activate) =>
|
|
Jolt.PInvoke.BodyInterface_AddTorque(this, bodyID, torque, activationMode);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// A combination of Body::AddForce and Body::AddTorque
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L223">Jolt/Physics/Body/BodyInterface.h:223</see>
|
|
/// <br/>
|
|
/// <c>void AddForceAndTorque(const BodyID &inBodyID, Vec3Arg inForce, Vec3Arg inTorque, EActivation inActivationMode = EActivation::Activate)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void AddForceAndTorque(
|
|
uint bodyID,
|
|
float3 force,
|
|
float3 torque,
|
|
Activation activationMode = Activation.Activate
|
|
) => Jolt.PInvoke.BodyInterface_AddForceAndTorque(this, bodyID, force, torque, activationMode);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Applied at center of mass. @see Body::AddImpulse
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L228">Jolt/Physics/Body/BodyInterface.h:228</see>
|
|
/// <br/>
|
|
/// <c>void AddImpulse(const BodyID &inBodyID, Vec3Arg inImpulse)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// @name Add an impulse to the body. Note that you should add a body to the physics system before applying impulses.
|
|
/// @{
|
|
/// </code>
|
|
/// </remarks>
|
|
public void AddImpulse(uint bodyID, float3 impulse) =>
|
|
Jolt.PInvoke.BodyInterface_AddImpulse(this, bodyID, impulse);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Applied at world space position inPoint. @see Body::AddImpulse
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L229">Jolt/Physics/Body/BodyInterface.h:229</see>
|
|
/// <br/>
|
|
/// <c>void AddImpulse(const BodyID &inBodyID, Vec3Arg inImpulse, RVec3Arg inPoint)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void AddImpulse(uint bodyID, float3 impulse, float3 point) =>
|
|
Jolt.PInvoke.BodyInterface_AddImpulse_2(this, bodyID, impulse, point);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::AddAngularImpulse
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L230">Jolt/Physics/Body/BodyInterface.h:230</see>
|
|
/// <br/>
|
|
/// <c>void AddAngularImpulse(const BodyID &inBodyID, Vec3Arg inAngularImpulse)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void AddAngularImpulse(uint bodyID, float3 angularImpulse) =>
|
|
Jolt.PInvoke.BodyInterface_AddAngularImpulse(this, bodyID, angularImpulse);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::ApplyBuoyancyImpulse
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L231">Jolt/Physics/Body/BodyInterface.h:231</see>
|
|
/// <br/>
|
|
/// <c>bool ApplyBuoyancyImpulse(const BodyID &inBodyID, RVec3Arg inSurfacePosition, Vec3Arg inSurfaceNormal, float inBuoyancy, float inLinearDrag, float inAngularDrag, Vec3Arg inFluidVelocity, Vec3Arg inGravity, float inDeltaTime)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public bool ApplyBuoyancyImpulse(
|
|
uint bodyID,
|
|
float3 surfacePosition,
|
|
float3 surfaceNormal,
|
|
float buoyancy,
|
|
float linearDrag,
|
|
float angularDrag,
|
|
float3 fluidVelocity,
|
|
float3 gravity,
|
|
float deltaTime
|
|
) =>
|
|
Jolt.PInvoke.BodyInterface_ApplyBuoyancyImpulse(
|
|
this,
|
|
bodyID,
|
|
surfacePosition,
|
|
surfaceNormal,
|
|
buoyancy,
|
|
linearDrag,
|
|
angularDrag,
|
|
fluidVelocity,
|
|
gravity,
|
|
deltaTime
|
|
);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::GetBodyType
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L236">Jolt/Physics/Body/BodyInterface.h:236</see>
|
|
/// <br/>
|
|
/// <c>EBodyType GetBodyType(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// @name Body type
|
|
/// @{
|
|
/// </code>
|
|
/// </remarks>
|
|
public BodyType GetBodyType(uint bodyID) => Jolt.PInvoke.BodyInterface_GetBodyType(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::SetMotionType
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L241">Jolt/Physics/Body/BodyInterface.h:241</see>
|
|
/// <br/>
|
|
/// <c>void SetMotionType(const BodyID &inBodyID, EMotionType inMotionType, EActivation inActivationMode)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// @name Body motion type
|
|
/// @{
|
|
/// </code>
|
|
/// </remarks>
|
|
public void SetMotionType(uint bodyID, MotionType motionType, Activation activationMode) =>
|
|
Jolt.PInvoke.BodyInterface_SetMotionType(this, bodyID, motionType, activationMode);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::GetMotionType
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L242">Jolt/Physics/Body/BodyInterface.h:242</see>
|
|
/// <br/>
|
|
/// <c>EMotionType GetMotionType(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public MotionType GetMotionType(uint bodyID) => Jolt.PInvoke.BodyInterface_GetMotionType(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// How well it detects collisions when it has a high velocity
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L247">Jolt/Physics/Body/BodyInterface.h:247</see>
|
|
/// <br/>
|
|
/// <c>void SetMotionQuality(const BodyID &inBodyID, EMotionQuality inMotionQuality)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// @name Body motion quality
|
|
/// @{
|
|
/// </code>
|
|
/// </remarks>
|
|
public void SetMotionQuality(uint bodyID, MotionQuality motionQuality) =>
|
|
Jolt.PInvoke.BodyInterface_SetMotionQuality(this, bodyID, motionQuality);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see MotionProperties::GetMotionQuality
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L248">Jolt/Physics/Body/BodyInterface.h:248</see>
|
|
/// <br/>
|
|
/// <c>EMotionQuality GetMotionQuality(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public MotionQuality GetMotionQuality(uint bodyID) => Jolt.PInvoke.BodyInterface_GetMotionQuality(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::GetInverseInertia
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L252">Jolt/Physics/Body/BodyInterface.h:252</see>
|
|
/// <br/>
|
|
/// <c>Mat44 GetInverseInertia(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Get inverse inertia tensor in world space
|
|
/// </para>
|
|
/// </remarks>
|
|
public float4x4 GetInverseInertia(uint bodyID) => Jolt.PInvoke.BodyInterface_GetInverseInertia(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::SetRestitution
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L256">Jolt/Physics/Body/BodyInterface.h:256</see>
|
|
/// <br/>
|
|
/// <c>void SetRestitution(const BodyID &inBodyID, float inRestitution)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// @name Restitution
|
|
/// @{
|
|
/// </code>
|
|
/// </remarks>
|
|
public void SetRestitution(uint bodyID, float restitution) =>
|
|
Jolt.PInvoke.BodyInterface_SetRestitution(this, bodyID, restitution);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::GetRestitution
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L257">Jolt/Physics/Body/BodyInterface.h:257</see>
|
|
/// <br/>
|
|
/// <c>float GetRestitution(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float GetRestitution(uint bodyID) => Jolt.PInvoke.BodyInterface_GetRestitution(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::SetFriction
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L262">Jolt/Physics/Body/BodyInterface.h:262</see>
|
|
/// <br/>
|
|
/// <c>void SetFriction(const BodyID &inBodyID, float inFriction)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// @name Friction
|
|
/// @{
|
|
/// </code>
|
|
/// </remarks>
|
|
public void SetFriction(uint bodyID, float friction) =>
|
|
Jolt.PInvoke.BodyInterface_SetFriction(this, bodyID, friction);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::GetFriction
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L263">Jolt/Physics/Body/BodyInterface.h:263</see>
|
|
/// <br/>
|
|
/// <c>float GetFriction(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float GetFriction(uint bodyID) => Jolt.PInvoke.BodyInterface_GetFriction(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see MotionProperties::SetGravityFactor
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L268">Jolt/Physics/Body/BodyInterface.h:268</see>
|
|
/// <br/>
|
|
/// <c>void SetGravityFactor(const BodyID &inBodyID, float inGravityFactor)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// @name Gravity factor
|
|
/// @{
|
|
/// </code>
|
|
/// </remarks>
|
|
public void SetGravityFactor(uint bodyID, float gravityFactor) =>
|
|
Jolt.PInvoke.BodyInterface_SetGravityFactor(this, bodyID, gravityFactor);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see MotionProperties::GetGravityFactor
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L269">Jolt/Physics/Body/BodyInterface.h:269</see>
|
|
/// <br/>
|
|
/// <c>float GetGravityFactor(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float GetGravityFactor(uint bodyID) => Jolt.PInvoke.BodyInterface_GetGravityFactor(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see MotionProperties::SetMaxLinearVelocity
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L274">Jolt/Physics/Body/BodyInterface.h:274</see>
|
|
/// <br/>
|
|
/// <c>void SetMaxLinearVelocity(const BodyID &inBodyID, float inLinearVelocity)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// @name Max linear velocity
|
|
/// @{
|
|
/// </code>
|
|
/// </remarks>
|
|
public void SetMaxLinearVelocity(uint bodyID, float linearVelocity) =>
|
|
Jolt.PInvoke.BodyInterface_SetMaxLinearVelocity(this, bodyID, linearVelocity);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see MotionProperties::GetMaxLinearVelocity
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L275">Jolt/Physics/Body/BodyInterface.h:275</see>
|
|
/// <br/>
|
|
/// <c>float GetMaxLinearVelocity(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float GetMaxLinearVelocity(uint bodyID) => Jolt.PInvoke.BodyInterface_GetMaxLinearVelocity(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see MotionProperties::SetMaxAngularVelocity
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L280">Jolt/Physics/Body/BodyInterface.h:280</see>
|
|
/// <br/>
|
|
/// <c>void SetMaxAngularVelocity(const BodyID &inBodyID, float inAngularVelocity)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// @name Max angular velocity
|
|
/// @{
|
|
/// </code>
|
|
/// </remarks>
|
|
public void SetMaxAngularVelocity(uint bodyID, float angularVelocity) =>
|
|
Jolt.PInvoke.BodyInterface_SetMaxAngularVelocity(this, bodyID, angularVelocity);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see MotionProperties::GetMaxAngularVelocity
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L281">Jolt/Physics/Body/BodyInterface.h:281</see>
|
|
/// <br/>
|
|
/// <c>float GetMaxAngularVelocity(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float GetMaxAngularVelocity(uint bodyID) =>
|
|
Jolt.PInvoke.BodyInterface_GetMaxAngularVelocity(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::SetUseManifoldReduction
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L286">Jolt/Physics/Body/BodyInterface.h:286</see>
|
|
/// <br/>
|
|
/// <c>void SetUseManifoldReduction(const BodyID &inBodyID, bool inUseReduction)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// @name Manifold reduction
|
|
/// @{
|
|
/// </code>
|
|
/// </remarks>
|
|
public void SetUseManifoldReduction(uint bodyID, bool useReduction) =>
|
|
Jolt.PInvoke.BodyInterface_SetUseManifoldReduction(this, bodyID, useReduction);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::GetUseManifoldReduction
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L287">Jolt/Physics/Body/BodyInterface.h:287</see>
|
|
/// <br/>
|
|
/// <c>bool GetUseManifoldReduction(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public bool GetUseManifoldReduction(uint bodyID) =>
|
|
Jolt.PInvoke.BodyInterface_GetUseManifoldReduction(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::SetIsSensor
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L292">Jolt/Physics/Body/BodyInterface.h:292</see>
|
|
/// <br/>
|
|
/// <c>void SetIsSensor(const BodyID &inBodyID, bool inIsSensor)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// @name Sensor
|
|
/// @{
|
|
/// </code>
|
|
/// </remarks>
|
|
public void SetIsSensor(uint bodyID, bool isSensor) =>
|
|
Jolt.PInvoke.BodyInterface_SetIsSensor(this, bodyID, isSensor);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::IsSensor
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L293">Jolt/Physics/Body/BodyInterface.h:293</see>
|
|
/// <br/>
|
|
/// <c>bool IsSensor(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public bool IsSensor(uint bodyID) => Jolt.PInvoke.BodyInterface_IsSensor(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::SetCollisionGroup
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L298">Jolt/Physics/Body/BodyInterface.h:298</see>
|
|
/// <br/>
|
|
/// <c>void SetCollisionGroup(const BodyID &inBodyID, const CollisionGroup &inCollisionGroup)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// @name Collision group
|
|
/// @{
|
|
/// </code>
|
|
/// </remarks>
|
|
public void SetCollisionGroup(uint bodyID, CollisionGroup collisionGroup) =>
|
|
Jolt.PInvoke.BodyInterface_SetCollisionGroup(this, bodyID, collisionGroup);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// @see Body::GetCollisionGroup
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L299">Jolt/Physics/Body/BodyInterface.h:299</see>
|
|
/// <br/>
|
|
/// <c>const CollisionGroup & GetCollisionGroup(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// The returned handle is borrowed from its owner; don't Dispose it.
|
|
/// </para>
|
|
/// </remarks>
|
|
public CollisionGroup GetCollisionGroup(uint bodyID) =>
|
|
Jolt.PInvoke.BodyInterface_GetCollisionGroup(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get transform and shape for this body, used to perform collision detection
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L303">Jolt/Physics/Body/BodyInterface.h:303</see>
|
|
/// <br/>
|
|
/// <c>TransformedShape GetTransformedShape(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// The returned handle is an owned copy; Dispose it when you're done with it.
|
|
/// </para>
|
|
/// </remarks>
|
|
public TransformedShape GetTransformedShape(uint bodyID) =>
|
|
Jolt.PInvoke.BodyInterface_GetTransformedShape(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get the user data for a body
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L306">Jolt/Physics/Body/BodyInterface.h:306</see>
|
|
/// <br/>
|
|
/// <c>uint64 GetUserData(const BodyID &inBodyID) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public ulong GetUserData(uint bodyID) => Jolt.PInvoke.BodyInterface_GetUserData(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L307">Jolt/Physics/Body/BodyInterface.h:307</see>
|
|
/// <br/>
|
|
/// <c>void SetUserData(const BodyID &inBodyID, uint64 inUserData) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetUserData(uint bodyID, ulong userData) =>
|
|
Jolt.PInvoke.BodyInterface_SetUserData(this, bodyID, userData);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get the material for a particular sub shape
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L310">Jolt/Physics/Body/BodyInterface.h:310</see>
|
|
/// <br/>
|
|
/// <c>const PhysicsMaterial * GetMaterial(const BodyID &inBodyID, const SubShapeID &inSubShapeID) const</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 bodyID, uint subShapeID) =>
|
|
Jolt.PInvoke.BodyInterface_GetMaterial(this, bodyID, subShapeID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Set the Body::EFlags::InvalidateContactCache flag for the specified body. This means that the collision
|
|
/// cache is invalid for any body pair involving that body until the next physics step.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Body/BodyInterface.h#L313">Jolt/Physics/Body/BodyInterface.h:313</see>
|
|
/// <br/>
|
|
/// <c>void InvalidateContactCache(const BodyID &inBodyID)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void InvalidateContactCache(uint bodyID) =>
|
|
Jolt.PInvoke.BodyInterface_InvalidateContactCache(this, bodyID);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Sets the position and rotation of every body in bodyIDs in one native call, through the same per-body
|
|
/// update BodyInterface.SetPositionAndRotation does (broad phase and activation included). Rotations must
|
|
/// be normalized. An ID that no longer names a body is skipped, as it is one at a time. Only as many
|
|
/// elements as there are IDs are read.
|
|
/// </para>
|
|
/// </summary>
|
|
public unsafe void SetPositionsAndRotations(
|
|
ReadOnlySpan<uint> bodyIDs,
|
|
ReadOnlySpan<float3> positions,
|
|
ReadOnlySpan<floatQuat> rotations,
|
|
Activation activation = Activation.Activate
|
|
)
|
|
{
|
|
fixed (floatQuat* rotations_fixed = rotations)
|
|
fixed (float3* positions_fixed = positions)
|
|
fixed (uint* bodyIDs_fixed = bodyIDs)
|
|
{
|
|
if (positions.Length < bodyIDs.Length)
|
|
throw new ArgumentException(
|
|
"positions must hold at least one element per body ID.",
|
|
nameof(positions)
|
|
);
|
|
if (rotations.Length < bodyIDs.Length)
|
|
throw new ArgumentException(
|
|
"rotations must hold at least one element per body ID.",
|
|
nameof(rotations)
|
|
);
|
|
Jolt.PInvoke.BodyInterface_SetPositionsAndRotations(
|
|
this,
|
|
bodyIDs_fixed,
|
|
(nuint)bodyIDs.Length,
|
|
positions_fixed,
|
|
(nuint)positions.Length,
|
|
rotations_fixed,
|
|
(nuint)rotations.Length,
|
|
activation
|
|
);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Like SetPositionsAndRotations, but leaves a body alone when its new position and rotation are within a
|
|
/// very small tolerance of its current ones, so syncing an unchanged body doesn't wake it or touch the
|
|
/// broad phase. Rotations must be normalized. An ID that no longer names a body is skipped, as it is one at
|
|
/// a time. Only as many elements as there are IDs are read.
|
|
/// </para>
|
|
/// </summary>
|
|
public unsafe void SetPositionsAndRotationsWhenChanged(
|
|
ReadOnlySpan<uint> bodyIDs,
|
|
ReadOnlySpan<float3> positions,
|
|
ReadOnlySpan<floatQuat> rotations,
|
|
Activation activation = Activation.Activate
|
|
)
|
|
{
|
|
fixed (floatQuat* rotations_fixed = rotations)
|
|
fixed (float3* positions_fixed = positions)
|
|
fixed (uint* bodyIDs_fixed = bodyIDs)
|
|
{
|
|
if (positions.Length < bodyIDs.Length)
|
|
throw new ArgumentException(
|
|
"positions must hold at least one element per body ID.",
|
|
nameof(positions)
|
|
);
|
|
if (rotations.Length < bodyIDs.Length)
|
|
throw new ArgumentException(
|
|
"rotations must hold at least one element per body ID.",
|
|
nameof(rotations)
|
|
);
|
|
Jolt.PInvoke.BodyInterface_SetPositionsAndRotationsWhenChanged(
|
|
this,
|
|
bodyIDs_fixed,
|
|
(nuint)bodyIDs.Length,
|
|
positions_fixed,
|
|
(nuint)positions.Length,
|
|
rotations_fixed,
|
|
(nuint)rotations.Length,
|
|
activation
|
|
);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Moves every kinematic body in bodyIDs towards its target position and rotation over deltaTime in one
|
|
/// native call, as BodyInterface.MoveKinematic does per body - the way to drive many animated bodies each
|
|
/// frame. An ID that no longer names a body is skipped, as it is one at a time. Only as many elements as
|
|
/// there are IDs are read.
|
|
/// </para>
|
|
/// </summary>
|
|
public unsafe void MoveKinematics(
|
|
ReadOnlySpan<uint> bodyIDs,
|
|
ReadOnlySpan<float3> positions,
|
|
ReadOnlySpan<floatQuat> rotations,
|
|
float deltaTime
|
|
)
|
|
{
|
|
fixed (floatQuat* rotations_fixed = rotations)
|
|
fixed (float3* positions_fixed = positions)
|
|
fixed (uint* bodyIDs_fixed = bodyIDs)
|
|
{
|
|
if (positions.Length < bodyIDs.Length)
|
|
throw new ArgumentException(
|
|
"positions must hold at least one element per body ID.",
|
|
nameof(positions)
|
|
);
|
|
if (rotations.Length < bodyIDs.Length)
|
|
throw new ArgumentException(
|
|
"rotations must hold at least one element per body ID.",
|
|
nameof(rotations)
|
|
);
|
|
Jolt.PInvoke.BodyInterface_MoveKinematics(
|
|
this,
|
|
bodyIDs_fixed,
|
|
(nuint)bodyIDs.Length,
|
|
positions_fixed,
|
|
(nuint)positions.Length,
|
|
rotations_fixed,
|
|
(nuint)rotations.Length,
|
|
deltaTime
|
|
);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Sets the linear and angular velocity of every body in bodyIDs in one native call, as
|
|
/// BodyInterface.SetLinearAndAngularVelocity does per body (clamped, and a moving body is woken). Static
|
|
/// bodies are left alone. An ID that no longer names a body is skipped, as it is one at a time. Only as
|
|
/// many elements as there are IDs are read.
|
|
/// </para>
|
|
/// </summary>
|
|
public unsafe void SetLinearAndAngularVelocities(
|
|
ReadOnlySpan<uint> bodyIDs,
|
|
ReadOnlySpan<float3> linearVelocities,
|
|
ReadOnlySpan<float3> angularVelocities
|
|
)
|
|
{
|
|
fixed (float3* angularVelocities_fixed = angularVelocities)
|
|
fixed (float3* linearVelocities_fixed = linearVelocities)
|
|
fixed (uint* bodyIDs_fixed = bodyIDs)
|
|
{
|
|
if (linearVelocities.Length < bodyIDs.Length)
|
|
throw new ArgumentException(
|
|
"linearVelocities must hold at least one element per body ID.",
|
|
nameof(linearVelocities)
|
|
);
|
|
if (angularVelocities.Length < bodyIDs.Length)
|
|
throw new ArgumentException(
|
|
"angularVelocities must hold at least one element per body ID.",
|
|
nameof(angularVelocities)
|
|
);
|
|
Jolt.PInvoke.BodyInterface_SetLinearAndAngularVelocities(
|
|
this,
|
|
bodyIDs_fixed,
|
|
(nuint)bodyIDs.Length,
|
|
linearVelocities_fixed,
|
|
(nuint)linearVelocities.Length,
|
|
angularVelocities_fixed,
|
|
(nuint)angularVelocities.Length
|
|
);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Adds a force at the center of mass of every body in bodyIDs in one native call, as
|
|
/// BodyInterface.AddForce does per body - wind, buoyancy or any force field over many bodies. An ID that no
|
|
/// longer names a body is skipped, as it is one at a time. Only as many elements as there are IDs are read.
|
|
/// </para>
|
|
/// </summary>
|
|
public unsafe void AddForces(
|
|
ReadOnlySpan<uint> bodyIDs,
|
|
ReadOnlySpan<float3> forces,
|
|
Activation activation = Activation.Activate
|
|
)
|
|
{
|
|
fixed (float3* forces_fixed = forces)
|
|
fixed (uint* bodyIDs_fixed = bodyIDs)
|
|
{
|
|
if (forces.Length < bodyIDs.Length)
|
|
throw new ArgumentException("forces must hold at least one element per body ID.", nameof(forces));
|
|
Jolt.PInvoke.BodyInterface_AddForces(
|
|
this,
|
|
bodyIDs_fixed,
|
|
(nuint)bodyIDs.Length,
|
|
forces_fixed,
|
|
(nuint)forces.Length,
|
|
activation
|
|
);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Adds an impulse at the center of mass of every body in bodyIDs in one native call, as
|
|
/// BodyInterface.AddImpulse does per body - an explosion over many bodies at once. An ID that no longer
|
|
/// names a body is skipped, as it is one at a time. Only as many elements as there are IDs are read.
|
|
/// </para>
|
|
/// </summary>
|
|
public unsafe void AddImpulses(ReadOnlySpan<uint> bodyIDs, ReadOnlySpan<float3> impulses)
|
|
{
|
|
fixed (float3* impulses_fixed = impulses)
|
|
fixed (uint* bodyIDs_fixed = bodyIDs)
|
|
{
|
|
if (impulses.Length < bodyIDs.Length)
|
|
throw new ArgumentException(
|
|
"impulses must hold at least one element per body ID.",
|
|
nameof(impulses)
|
|
);
|
|
Jolt.PInvoke.BodyInterface_AddImpulses(
|
|
this,
|
|
bodyIDs_fixed,
|
|
(nuint)bodyIDs.Length,
|
|
impulses_fixed,
|
|
(nuint)impulses.Length
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|