mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-26 04:58:24 +01:00
579 lines
26 KiB
C#
579 lines
26 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>
|
|
/// Runtime ragdoll information
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L136">Jolt/Physics/Ragdoll/Ragdoll.h:136</see>
|
|
/// <br/>
|
|
/// <c>class Ragdoll : public RefTarget<Ragdoll>, public NonCopyable</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[InteropHandle]
|
|
public readonly partial struct Ragdoll : IDisposable
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// Constructor
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L142">Jolt/Physics/Ragdoll/Ragdoll.h:142</see>
|
|
/// <br/>
|
|
/// <c>explicit Ragdoll(PhysicsSystem *inSystem)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public static Ragdoll Create(PhysicsSystem system) => Jolt.PInvoke.Ragdoll_Create(system);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Add bodies and constraints to the system and optionally activate the bodies
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L148">Jolt/Physics/Ragdoll/Ragdoll.h:148</see>
|
|
/// <br/>
|
|
/// <c>void AddToPhysicsSystem(EActivation inActivationMode, bool inLockBodies = true)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void AddToPhysicsSystem(Activation activationMode, bool lockBodies = true) =>
|
|
Jolt.PInvoke.Ragdoll_AddToPhysicsSystem(this, activationMode, lockBodies);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Remove bodies and constraints from the system
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L151">Jolt/Physics/Ragdoll/Ragdoll.h:151</see>
|
|
/// <br/>
|
|
/// <c>void RemoveFromPhysicsSystem(bool inLockBodies = true)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void RemoveFromPhysicsSystem(bool lockBodies = true) =>
|
|
Jolt.PInvoke.Ragdoll_RemoveFromPhysicsSystem(this, lockBodies);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Wake up all bodies in the ragdoll
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L154">Jolt/Physics/Ragdoll/Ragdoll.h:154</see>
|
|
/// <br/>
|
|
/// <c>void Activate(bool inLockBodies = true)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void Activate(bool lockBodies = true) => Jolt.PInvoke.Ragdoll_Activate(this, lockBodies);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Check if one or more of the bodies in the ragdoll are active. Note that this involves locking the bodies
|
|
/// (if inLockBodies is true) and looping over them. An alternative and possibly faster way could be to
|
|
/// install a BodyActivationListener and count the number of active bodies of a ragdoll as they're activated
|
|
/// / deactivated (basically check if the body that activates / deactivates is in GetBodyIDs() and increment
|
|
/// / decrement a counter).
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L160">Jolt/Physics/Ragdoll/Ragdoll.h:160</see>
|
|
/// <br/>
|
|
/// <c>bool IsActive(bool inLockBodies = true) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public bool IsActive(bool lockBodies = true) => Jolt.PInvoke.Ragdoll_IsActive(this, lockBodies);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Set the group ID on all bodies in the ragdoll
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L163">Jolt/Physics/Ragdoll/Ragdoll.h:163</see>
|
|
/// <br/>
|
|
/// <c>void SetGroupID(CollisionGroup::GroupID inGroupID, bool inLockBodies = true)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetGroupID(uint groupID, bool lockBodies = true) =>
|
|
Jolt.PInvoke.Ragdoll_SetGroupID(this, groupID, lockBodies);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Set the ragdoll to a pose (calls BodyInterface::SetPositionAndRotation to instantly move the ragdoll)
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L166">Jolt/Physics/Ragdoll/Ragdoll.h:166</see>
|
|
/// <br/>
|
|
/// <c>void SetPose(const SkeletonPose &inPose, bool inLockBodies = true)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetPose(SkeletonPose pose, bool lockBodies = true) =>
|
|
Jolt.PInvoke.Ragdoll_SetPose(this, pose, lockBodies);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Lower level version of SetPose that directly takes the world space joint matrices
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L169">Jolt/Physics/Ragdoll/Ragdoll.h:169</see>
|
|
/// <br/>
|
|
/// <c>void SetPose(RVec3Arg inRootOffset, const Mat44 *inJointMatrices, bool inLockBodies = true)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// jointMatrices must hold exactly one element per body in the ragdoll - the native count is read from the
|
|
/// object itself and a span that doesn't match it throws ArgumentOutOfRangeException. The span is only used
|
|
/// for the duration of the call.
|
|
/// </para>
|
|
/// </remarks>
|
|
public unsafe void SetPose(float3 rootOffset, ReadOnlySpan<float4x4> jointMatrices, bool lockBodies = true)
|
|
{
|
|
fixed (float4x4* jointMatrices_fixed = jointMatrices)
|
|
{
|
|
Jolt.PInvoke.Ragdoll_SetPose_2(
|
|
this,
|
|
rootOffset,
|
|
jointMatrices_fixed,
|
|
(uint)jointMatrices.Length,
|
|
lockBodies,
|
|
out var _bufferCheck
|
|
);
|
|
if (_bufferCheck == 1)
|
|
throw new ArgumentOutOfRangeException(
|
|
nameof(jointMatrices),
|
|
jointMatrices.Length,
|
|
"Expected one element per body in the ragdoll."
|
|
);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get the ragdoll pose (uses the world transform of the bodies to calculate the pose)
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L172">Jolt/Physics/Ragdoll/Ragdoll.h:172</see>
|
|
/// <br/>
|
|
/// <c>void GetPose(SkeletonPose &outPose, bool inLockBodies = true)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void GetPose(SkeletonPose pose, bool lockBodies = true) =>
|
|
Jolt.PInvoke.Ragdoll_GetPose(this, pose, lockBodies);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Lower level version of GetPose that directly returns the world space joint matrices
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L175">Jolt/Physics/Ragdoll/Ragdoll.h:175</see>
|
|
/// <br/>
|
|
/// <c>void GetPose(RVec3 &outRootOffset, Mat44 *outJointMatrices, bool inLockBodies = true)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// jointMatrices must hold exactly one element per body in the ragdoll - the native count is read from the
|
|
/// object itself and a span that doesn't match it throws ArgumentOutOfRangeException. The span is only used
|
|
/// for the duration of the call.
|
|
/// </para>
|
|
/// </remarks>
|
|
public unsafe void GetPose(out float3 rootOffset, Span<float4x4> jointMatrices, bool lockBodies = true)
|
|
{
|
|
fixed (float4x4* jointMatrices_fixed = jointMatrices)
|
|
{
|
|
Jolt.PInvoke.Ragdoll_GetPose_2(
|
|
this,
|
|
out rootOffset,
|
|
jointMatrices_fixed,
|
|
(uint)jointMatrices.Length,
|
|
lockBodies,
|
|
out var _bufferCheck
|
|
);
|
|
if (_bufferCheck == 1)
|
|
throw new ArgumentOutOfRangeException(
|
|
nameof(jointMatrices),
|
|
jointMatrices.Length,
|
|
"Expected one element per body in the ragdoll."
|
|
);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// This function calls ResetWarmStart on all constraints. It can be used after calling SetPose to reset
|
|
/// previous frames impulses. See: Constraint::ResetWarmStart.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L178">Jolt/Physics/Ragdoll/Ragdoll.h:178</see>
|
|
/// <br/>
|
|
/// <c>void ResetWarmStart()</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void ResetWarmStart() => Jolt.PInvoke.Ragdoll_ResetWarmStart(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Drive the ragdoll to a specific pose by setting velocities on each of the bodies so that it will reach
|
|
/// inPose in inDeltaTime
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L181">Jolt/Physics/Ragdoll/Ragdoll.h:181</see>
|
|
/// <br/>
|
|
/// <c>void DriveToPoseUsingKinematics(const SkeletonPose &inPose, float inDeltaTime, bool inLockBodies = true)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void DriveToPoseUsingKinematics(SkeletonPose pose, float deltaTime, bool lockBodies = true) =>
|
|
Jolt.PInvoke.Ragdoll_DriveToPoseUsingKinematics(this, pose, deltaTime, lockBodies);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Lower level version of DriveToPoseUsingKinematics that directly takes the world space joint matrices
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L184">Jolt/Physics/Ragdoll/Ragdoll.h:184</see>
|
|
/// <br/>
|
|
/// <c>void DriveToPoseUsingKinematics(RVec3Arg inRootOffset, const Mat44 *inJointMatrices, float inDeltaTime, bool inLockBodies = true)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// jointMatrices must hold exactly one element per body in the ragdoll - the native count is read from the
|
|
/// object itself and a span that doesn't match it throws ArgumentOutOfRangeException. The span is only used
|
|
/// for the duration of the call.
|
|
/// </para>
|
|
/// </remarks>
|
|
public unsafe void DriveToPoseUsingKinematics(
|
|
float3 rootOffset,
|
|
ReadOnlySpan<float4x4> jointMatrices,
|
|
float deltaTime,
|
|
bool lockBodies = true
|
|
)
|
|
{
|
|
fixed (float4x4* jointMatrices_fixed = jointMatrices)
|
|
{
|
|
Jolt.PInvoke.Ragdoll_DriveToPoseUsingKinematics_2(
|
|
this,
|
|
rootOffset,
|
|
jointMatrices_fixed,
|
|
(uint)jointMatrices.Length,
|
|
deltaTime,
|
|
lockBodies,
|
|
out var _bufferCheck
|
|
);
|
|
if (_bufferCheck == 1)
|
|
throw new ArgumentOutOfRangeException(
|
|
nameof(jointMatrices),
|
|
jointMatrices.Length,
|
|
"Expected one element per body in the ragdoll."
|
|
);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Drive the ragdoll to a specific pose by activating the motors on each constraint.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L187">Jolt/Physics/Ragdoll/Ragdoll.h:187</see>
|
|
/// <br/>
|
|
/// <c>void DriveToPoseUsingMotors(const SkeletonPose &inPose)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Throws ArgumentException for pose: "pose must use the ragdoll's own skeleton (SkeletonPose.SetSkeleton
|
|
/// with RagdollSettings.GetSkeleton())."
|
|
/// </para>
|
|
/// </remarks>
|
|
public void DriveToPoseUsingMotors(SkeletonPose pose)
|
|
{
|
|
Jolt.PInvoke.Ragdoll_DriveToPoseUsingMotors(this, pose, out var _bufferCheck);
|
|
if (_bufferCheck == 1)
|
|
throw new ArgumentException(
|
|
"pose must use the ragdoll's own skeleton (SkeletonPose.SetSkeleton with RagdollSettings.GetSkeleton()).",
|
|
nameof(pose)
|
|
);
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Drive the ragdoll to a specific pose by activating the motors on each constraint. Drives both to target
|
|
/// position and velocity.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L193">Jolt/Physics/Ragdoll/Ragdoll.h:193</see>
|
|
/// <br/>
|
|
/// <c>void DriveToPoseUsingMotors(const SkeletonPose &inPrevPose, const SkeletonPose &inPose, float inDeltaTime)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Drive the ragdoll to a specific pose by activating the motors on each constraint. Drives both to target position and velocity.
|
|
/// @param inPrevPose The previous pose of the ragdoll, used to calculate the target velocity for each motor
|
|
/// @param inPose The target pose of the ragdoll, used to calculate the target position for each motor
|
|
/// @param inDeltaTime The time between inPrevPose and inPose, used to calculate the target velocity for each motor
|
|
/// </code>
|
|
/// <para>
|
|
/// Throws ArgumentException for pose: "pose must use the ragdoll's own skeleton (SkeletonPose.SetSkeleton
|
|
/// with RagdollSettings.GetSkeleton())." Throws ArgumentException for prevPose: "prevPose must use the
|
|
/// ragdoll's own skeleton (SkeletonPose.SetSkeleton with RagdollSettings.GetSkeleton())." Throws
|
|
/// ArgumentException for deltaTime: "deltaTime must be greater than zero."
|
|
/// </para>
|
|
/// </remarks>
|
|
public void DriveToPoseUsingMotors(SkeletonPose prevPose, SkeletonPose pose, float deltaTime)
|
|
{
|
|
Jolt.PInvoke.Ragdoll_DriveToPoseUsingMotors_2(this, prevPose, pose, deltaTime, out var _bufferCheck);
|
|
if (_bufferCheck == 1)
|
|
throw new ArgumentException(
|
|
"pose must use the ragdoll's own skeleton (SkeletonPose.SetSkeleton with RagdollSettings.GetSkeleton()).",
|
|
nameof(pose)
|
|
);
|
|
if (_bufferCheck == 2)
|
|
throw new ArgumentException(
|
|
"prevPose must use the ragdoll's own skeleton (SkeletonPose.SetSkeleton with RagdollSettings.GetSkeleton()).",
|
|
nameof(prevPose)
|
|
);
|
|
if (_bufferCheck == 3)
|
|
throw new ArgumentException("deltaTime must be greater than zero.", nameof(deltaTime));
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Control the linear and velocity of all bodies in the ragdoll
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L196">Jolt/Physics/Ragdoll/Ragdoll.h:196</see>
|
|
/// <br/>
|
|
/// <c>void SetLinearAndAngularVelocity(Vec3Arg inLinearVelocity, Vec3Arg inAngularVelocity, bool inLockBodies = true)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetLinearAndAngularVelocity(
|
|
float3 linearVelocity,
|
|
float3 angularVelocity,
|
|
bool lockBodies = true
|
|
) => Jolt.PInvoke.Ragdoll_SetLinearAndAngularVelocity(this, linearVelocity, angularVelocity, lockBodies);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Set the world space linear velocity of all bodies in the ragdoll.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L199">Jolt/Physics/Ragdoll/Ragdoll.h:199</see>
|
|
/// <br/>
|
|
/// <c>void SetLinearVelocity(Vec3Arg inLinearVelocity, bool inLockBodies = true)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void SetLinearVelocity(float3 linearVelocity, bool lockBodies = true) =>
|
|
Jolt.PInvoke.Ragdoll_SetLinearVelocity(this, linearVelocity, lockBodies);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Add a world space velocity (in m/s) to all bodies in the ragdoll.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L202">Jolt/Physics/Ragdoll/Ragdoll.h:202</see>
|
|
/// <br/>
|
|
/// <c>void AddLinearVelocity(Vec3Arg inLinearVelocity, bool inLockBodies = true)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void AddLinearVelocity(float3 linearVelocity, bool lockBodies = true) =>
|
|
Jolt.PInvoke.Ragdoll_AddLinearVelocity(this, linearVelocity, lockBodies);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Add impulse to all bodies of the ragdoll (center of mass of each of them)
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L205">Jolt/Physics/Ragdoll/Ragdoll.h:205</see>
|
|
/// <br/>
|
|
/// <c>void AddImpulse(Vec3Arg inImpulse, bool inLockBodies = true)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void AddImpulse(float3 impulse, bool lockBodies = true) =>
|
|
Jolt.PInvoke.Ragdoll_AddImpulse(this, impulse, lockBodies);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get the position and orientation of the root of the ragdoll
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L208">Jolt/Physics/Ragdoll/Ragdoll.h:208</see>
|
|
/// <br/>
|
|
/// <c>void GetRootTransform(RVec3 &outPosition, Quat &outRotation, bool inLockBodies = true) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void GetRootTransform(out float3 position, out floatQuat rotation, bool lockBodies = true) =>
|
|
Jolt.PInvoke.Ragdoll_GetRootTransform(this, out position, out rotation, lockBodies);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get number of bodies in the ragdoll
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L211">Jolt/Physics/Ragdoll/Ragdoll.h:211</see>
|
|
/// <br/>
|
|
/// <c>size_t GetBodyCount() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public ElementCount GetBodyCount() => (ElementCount)Jolt.PInvoke.Ragdoll_GetBodyCount(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Access a body ID
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L214">Jolt/Physics/Ragdoll/Ragdoll.h:214</see>
|
|
/// <br/>
|
|
/// <c>BodyID GetBodyID(int inBodyIndex) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public uint GetBodyID(int bodyIndex)
|
|
{
|
|
var _result = Jolt.PInvoke.Ragdoll_GetBodyID(this, bodyIndex, out var _inRange);
|
|
if (_inRange == 0)
|
|
throw new ArgumentOutOfRangeException(
|
|
nameof(bodyIndex),
|
|
bodyIndex,
|
|
"Expected an index below the number of bodies."
|
|
);
|
|
return _result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Access to the array of body IDs
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L217">Jolt/Physics/Ragdoll/Ragdoll.h:217</see>
|
|
/// <br/>
|
|
/// <c>const Array<BodyID> & GetBodyIDs() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// 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.
|
|
/// </para>
|
|
/// </remarks>
|
|
[return: Brutal.Attributes.Fixed]
|
|
public unsafe ReadOnlySpan<uint> GetBodyIDs()
|
|
{
|
|
Jolt.PInvoke.Ragdoll_GetBodyIDs(this, out var _outResult);
|
|
return new ReadOnlySpan<uint>((void*)_outResult.Data, checked((int)_outResult.Count));
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get number of constraints in the ragdoll
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L220">Jolt/Physics/Ragdoll/Ragdoll.h:220</see>
|
|
/// <br/>
|
|
/// <c>size_t GetConstraintCount() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public ElementCount GetConstraintCount() => (ElementCount)Jolt.PInvoke.Ragdoll_GetConstraintCount(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Access a constraint by index
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L223">Jolt/Physics/Ragdoll/Ragdoll.h:223</see>
|
|
/// <br/>
|
|
/// <c>TwoBodyConstraint * GetConstraint(int inConstraintIndex)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// The returned handle carries its own reference; Dispose it once when you're done.
|
|
/// </para>
|
|
/// </remarks>
|
|
public TwoBodyConstraint GetConstraint(int constraintIndex)
|
|
{
|
|
var _result = Jolt.PInvoke.Ragdoll_GetConstraint(this, constraintIndex, out var _inRange);
|
|
if (_inRange == 0)
|
|
throw new ArgumentOutOfRangeException(
|
|
nameof(constraintIndex),
|
|
constraintIndex,
|
|
"Expected an index below the number of constraints."
|
|
);
|
|
return _result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get world space bounding box for all bodies of the ragdoll
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L229">Jolt/Physics/Ragdoll/Ragdoll.h:229</see>
|
|
/// <br/>
|
|
/// <c>AABox GetWorldSpaceBounds(bool inLockBodies = true) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public AABox GetWorldSpaceBounds(bool lockBodies = true) =>
|
|
Jolt.PInvoke.Ragdoll_GetWorldSpaceBounds(this, lockBodies);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get the settings object that created this ragdoll
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Ragdoll/Ragdoll.h#L232">Jolt/Physics/Ragdoll/Ragdoll.h:232</see>
|
|
/// <br/>
|
|
/// <c>const RagdollSettings * GetRagdollSettings() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// The returned handle carries its own reference; Dispose it once when you're done.
|
|
/// </para>
|
|
/// </remarks>
|
|
public RagdollSettings GetRagdollSettings() => Jolt.PInvoke.Ragdoll_GetRagdollSettings(this);
|
|
|
|
public void AddRef() => Jolt.PInvoke.Ragdoll_AddRef(this);
|
|
|
|
public void Release() => Jolt.PInvoke.Ragdoll_Release(this);
|
|
|
|
public uint GetRefCount() => Jolt.PInvoke.Ragdoll_GetRefCount(this);
|
|
|
|
public void Dispose()
|
|
{
|
|
if (IsNull())
|
|
return;
|
|
Release();
|
|
}
|
|
}
|
|
}
|