//
// 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
{
///
///
/// This class contains the runtime information of a soft body.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:34
///
/// class SoftBodyMotionProperties : public MotionProperties
///
///
///
///
/// This class contains the runtime information of a soft body.
///
/// Based on: XPBD, Extended Position Based Dynamics, Matthias Muller, Ten Minute Physics
/// See: https://matthias-research.github.io/pages/tenMinutePhysics/09-xpbd.pdf
///
///
[InteropHandle]
public readonly partial struct SoftBodyMotionProperties : IDisposable
{
///
///
/// Return code for ParallelUpdate
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:166
///
/// enum class EStatus
///
///
[Flags]
public enum Status : int
{
///
///
/// No work was done because other threads were still working on a batch that cannot run concurrently
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:168
///
/// NoWork = 1 << 0
///
///
NoWork = 1,
///
///
/// Work was done to progress the update
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:169
///
/// DidWork = 1 << 1
///
///
DidWork = 2,
///
///
/// All work is done
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:170
///
/// Done = 1 << 2
///
///
Done = 4,
}
///
///
/// Information about a leaf shape that we're colliding with
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:187
///
/// struct LeafShape
///
///
[StructLayout(LayoutKind.Explicit, Size = 96)]
public partial struct LeafShape
{
///
///
/// Transform of the shape relative to the soft body
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:192
///
/// Mat44 mTransform
///
///
[FieldOffset(0)]
public float4x4 Transform;
///
///
/// Scale of the shape
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:193
///
/// Vec3 mScale
///
///
[FieldOffset(64)]
public float3 Scale;
///
///
/// Shape
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:194
///
/// RefConst<Shape> mShape
///
///
[FieldOffset(80)]
public Shape Shape;
}
///
///
/// Information about the current state of a rod.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:232
///
/// struct RodState
///
///
[StructLayout(LayoutKind.Explicit, Size = 32)]
public partial struct RodState
{
///
///
/// Rotation of the rod, relative to center of mass transform
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:234
///
/// Quat mRotation
///
///
[FieldOffset(0)]
public floatQuat Rotation;
}
///
///
/// Information about the state of all skinned vertices
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:243
///
/// struct SkinState
///
///
[StructLayout(LayoutKind.Explicit, Size = 48)]
public partial struct SkinState
{
///
///
/// Previous position of the skinned vertex, used to interpolate between the previous and current
/// position
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:245
///
/// Vec3 mPreviousPosition = Vec3::sZero()
///
///
[FieldOffset(0)]
public float3 PreviousPosition;
///
///
/// Current position of the skinned vertex
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:246
///
/// Vec3 mPosition = Vec3::sNaN()
///
///
[FieldOffset(16)]
public float3 Position;
///
///
/// Normal of the skinned vertex
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:247
///
/// Vec3 mNormal = Vec3::sNaN()
///
///
[FieldOffset(32)]
public float3 Normal;
}
public static SoftBodyMotionProperties Create() => Jolt.PInvoke.SoftBodyMotionProperties_Create();
///
///
/// Initialize the soft body motion properties
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:50
///
/// void Initialize(const SoftBodyCreationSettings &inSettings)
///
///
public void Initialize(SoftBodyCreationSettings settings) =>
Jolt.PInvoke.SoftBodyMotionProperties_Initialize(this, settings);
///
///
/// Get the shared settings of the soft body
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:53
///
/// const SoftBodySharedSettings * GetSettings() const
///
///
///
///
/// The returned handle carries its own reference; Dispose it once when you're done.
///
///
public SoftBodySharedSettings GetSettings() => Jolt.PInvoke.SoftBodyMotionProperties_GetSettings(this);
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:57
///
/// Array<Vertex> & GetVertices()
///
///
///
///
/// The span is a view of the container's own storage, not a copy, so it costs nothing to take. It's only
/// valid until that container is resized or its owner is destroyed.
///
///
[return: Brutal.Attributes.Fixed]
public unsafe ReadOnlySpan GetVertices()
{
Jolt.PInvoke.SoftBodyMotionProperties_GetVertices(this, out var _outResult);
return new ReadOnlySpan((void*)_outResult.Data, checked((int)_outResult.Count));
}
///
///
/// Access an individual vertex
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:60
///
/// const Vertex & GetVertex(uint inIndex) const
///
///
public SoftBodyVertex GetVertex(uint index)
{
var _result = Jolt.PInvoke.SoftBodyMotionProperties_GetVertex(this, index, out var _inRange);
if (_inRange == 0)
throw new ArgumentOutOfRangeException(
nameof(index),
index,
"Expected an index below the number of vertices."
);
return _result;
}
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:61
///
/// Vertex & GetVertex(uint inIndex)
///
///
///
///
/// Writes value into the element GetVertex returns, in place. The C++ getter hands out a reference; the C#
/// GetVertex can only return a copy, so this is how an edit reaches the object.
///
///
public void SetVertex(uint index, in SoftBodyVertex value)
{
Jolt.PInvoke.SoftBodyMotionProperties_SetVertex(this, index, in value, out var _inRange);
if (_inRange == 0)
throw new ArgumentOutOfRangeException(
nameof(index),
index,
"Expected an index below the number of vertices."
);
}
///
///
/// Writes a run of elements through GetVertex in one call, starting at startIndex - the same per-element
/// write SetVertex does, without a boundary crossing each. Writes value.Length elements, and throws
/// ArgumentOutOfRangeException if that run would reach past the last of the vertices.
///
///
public unsafe void SetVertices(ReadOnlySpan value, uint startIndex = 0)
{
fixed (SoftBodyVertex* value_fixed = value)
{
Jolt.PInvoke.SoftBodyMotionProperties_SetVertices(
this,
value_fixed,
(nuint)value.Length,
startIndex,
out var _inRange
);
if (_inRange == 0)
throw new ArgumentOutOfRangeException(
nameof(startIndex),
startIndex,
"Expected startIndex and value.Length to describe a run inside the vertices."
);
}
}
///
///
/// Access to the state of rods
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:64
///
/// Quat GetRodRotation(uint inIndex) const
///
///
public floatQuat GetRodRotation(uint index)
{
var _result = Jolt.PInvoke.SoftBodyMotionProperties_GetRodRotation(this, index, out var _inRange);
if (_inRange == 0)
throw new ArgumentOutOfRangeException(
nameof(index),
index,
"Expected an index below the number of rods."
);
return _result;
}
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:65
///
/// Vec3 GetRodAngularVelocity(uint inIndex) const
///
///
public float3 GetRodAngularVelocity(uint index)
{
var _result = Jolt.PInvoke.SoftBodyMotionProperties_GetRodAngularVelocity(this, index, out var _inRange);
if (_inRange == 0)
throw new ArgumentOutOfRangeException(
nameof(index),
index,
"Expected an index below the number of rods."
);
return _result;
}
///
///
/// Get the materials of the soft body
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:68
///
/// const PhysicsMaterialList & GetMaterials() const
///
///
///
///
/// Returns an owned native buffer - read it through AsSpan() and Dispose it when you are done with it. The
/// handles in it are borrowed views into the buffer: they stay valid until Dispose and must not be disposed
/// themselves.
///
///
public NativeArray GetMaterials() =>
new NativeArray(Jolt.PInvoke.SoftBodyMotionProperties_GetMaterials(this));
///
///
/// Get the faces of the soft body
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:71
///
/// const Array<Face> & GetFaces() const
///
///
///
///
/// The span is a view of the container's own storage, not a copy, so it costs nothing to take. It's only
/// valid until that container is resized or its owner is destroyed.
///
///
[return: Brutal.Attributes.Fixed]
public unsafe ReadOnlySpan GetFaces()
{
Jolt.PInvoke.SoftBodyMotionProperties_GetFaces(this, out var _outResult);
return new ReadOnlySpan(
(void*)_outResult.Data,
checked((int)_outResult.Count)
);
}
///
///
/// Access to an individual face
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:74
///
/// const Face & GetFace(uint inIndex) const
///
///
public SoftBodySharedSettings.Face GetFace(uint index)
{
Jolt.PInvoke.SoftBodyMotionProperties_GetFace(this, index, out var _inRange, out var _outResult);
if (_inRange == 0)
throw new ArgumentOutOfRangeException(
nameof(index),
index,
"Expected an index below the number of faces."
);
return _outResult;
}
///
///
/// Get the number of solver iterations
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:77
///
/// uint32 GetNumIterations() const
///
///
public uint GetNumIterations() => Jolt.PInvoke.SoftBodyMotionProperties_GetNumIterations(this);
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:78
///
/// void SetNumIterations(uint32 inNumIterations)
///
///
public void SetNumIterations(uint numIterations) =>
Jolt.PInvoke.SoftBodyMotionProperties_SetNumIterations(this, numIterations);
///
///
/// Get the pressure of the soft body
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:81
///
/// float GetPressure() const
///
///
public float GetPressure() => Jolt.PInvoke.SoftBodyMotionProperties_GetPressure(this);
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:82
///
/// void SetPressure(float inPressure)
///
///
public void SetPressure(float pressure) => Jolt.PInvoke.SoftBodyMotionProperties_SetPressure(this, pressure);
///
///
/// Update the position of the body while simulating (set to false for something that is attached to the
/// static world)
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:85
///
/// bool GetUpdatePosition() const
///
///
public bool GetUpdatePosition() => Jolt.PInvoke.SoftBodyMotionProperties_GetUpdatePosition(this);
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:86
///
/// void SetUpdatePosition(bool inUpdatePosition)
///
///
public void SetUpdatePosition(bool updatePosition) =>
Jolt.PInvoke.SoftBodyMotionProperties_SetUpdatePosition(this, updatePosition);
///
///
/// If the faces in this soft body should be treated as double sided for the purpose of collision detection
/// (ray cast / collide shape / cast shape)
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:89
///
/// bool GetFacesDoubleSided() const
///
///
public bool GetFacesDoubleSided() => Jolt.PInvoke.SoftBodyMotionProperties_GetFacesDoubleSided(this);
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:90
///
/// void SetFacesDoubleSided(bool inDoubleSided)
///
///
public void SetFacesDoubleSided(bool doubleSided) =>
Jolt.PInvoke.SoftBodyMotionProperties_SetFacesDoubleSided(this, doubleSided);
///
///
/// Global setting to turn on/off skin constraints
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:93
///
/// bool GetEnableSkinConstraints() const
///
///
public bool GetEnableSkinConstraints() => Jolt.PInvoke.SoftBodyMotionProperties_GetEnableSkinConstraints(this);
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:94
///
/// void SetEnableSkinConstraints(bool inEnableSkinConstraints)
///
///
public void SetEnableSkinConstraints(bool enableSkinConstraints) =>
Jolt.PInvoke.SoftBodyMotionProperties_SetEnableSkinConstraints(this, enableSkinConstraints);
///
///
/// Multiplier applied to Skinned::mMaxDistance to allow tightening or loosening of the skin constraints. 0
/// to hard skin all vertices.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:97
///
/// float GetSkinnedMaxDistanceMultiplier() const
///
///
public float GetSkinnedMaxDistanceMultiplier() =>
Jolt.PInvoke.SoftBodyMotionProperties_GetSkinnedMaxDistanceMultiplier(this);
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:98
///
/// void SetSkinnedMaxDistanceMultiplier(float inSkinnedMaxDistanceMultiplier)
///
///
public void SetSkinnedMaxDistanceMultiplier(float skinnedMaxDistanceMultiplier) =>
Jolt.PInvoke.SoftBodyMotionProperties_SetSkinnedMaxDistanceMultiplier(this, skinnedMaxDistanceMultiplier);
///
///
/// How big the particles are, can be used to push the vertices a little bit away from the surface of other
/// bodies to prevent z-fighting
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:101
///
/// float GetVertexRadius() const
///
///
public float GetVertexRadius() => Jolt.PInvoke.SoftBodyMotionProperties_GetVertexRadius(this);
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:102
///
/// void SetVertexRadius(float inVertexRadius)
///
///
public void SetVertexRadius(float vertexRadius) =>
Jolt.PInvoke.SoftBodyMotionProperties_SetVertexRadius(this, vertexRadius);
///
///
/// Get local bounding box
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:105
///
/// const AABox & GetLocalBounds() const
///
///
public AABox GetLocalBounds() => Jolt.PInvoke.SoftBodyMotionProperties_GetLocalBounds(this);
///
///
/// Get the volume of the soft body. Note can become negative if the shape is inside out!
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:108
///
/// float GetVolume() const
///
///
public float GetVolume() => Jolt.PInvoke.SoftBodyMotionProperties_GetVolume(this);
///
///
/// Calculate the total mass and inertia of this body based on the current state of the vertices
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:111
///
/// void CalculateMassAndInertia()
///
///
public void CalculateMassAndInertia() => Jolt.PInvoke.SoftBodyMotionProperties_CalculateMassAndInertia(this);
///
///
/// Draw the state of a soft body
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:115
///
/// void DrawVertices(DebugRenderer *inRenderer, RMat44Arg inCenterOfMassTransform) const
///
///
public void DrawVertices(DebugRenderer renderer, in float4x4 centerOfMassTransform) =>
Jolt.PInvoke.SoftBodyMotionProperties_DrawVertices(this, renderer, in centerOfMassTransform);
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:116
///
/// void DrawVertexVelocities(DebugRenderer *inRenderer, RMat44Arg inCenterOfMassTransform) const
///
///
public void DrawVertexVelocities(DebugRenderer renderer, in float4x4 centerOfMassTransform) =>
Jolt.PInvoke.SoftBodyMotionProperties_DrawVertexVelocities(this, renderer, in centerOfMassTransform);
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:117
///
/// void DrawEdgeConstraints(DebugRenderer *inRenderer, RMat44Arg inCenterOfMassTransform, ESoftBodyConstraintColor inConstraintColor) const
///
///
public void DrawEdgeConstraints(
DebugRenderer renderer,
in float4x4 centerOfMassTransform,
SoftBodyConstraintColor constraintColor
) =>
Jolt.PInvoke.SoftBodyMotionProperties_DrawEdgeConstraints(
this,
renderer,
in centerOfMassTransform,
constraintColor
);
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:118
///
/// void DrawRods(DebugRenderer *inRenderer, RMat44Arg inCenterOfMassTransform, ESoftBodyConstraintColor inConstraintColor) const
///
///
public void DrawRods(
DebugRenderer renderer,
in float4x4 centerOfMassTransform,
SoftBodyConstraintColor constraintColor
) => Jolt.PInvoke.SoftBodyMotionProperties_DrawRods(this, renderer, in centerOfMassTransform, constraintColor);
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:119
///
/// void DrawRodStates(DebugRenderer *inRenderer, RMat44Arg inCenterOfMassTransform, ESoftBodyConstraintColor inConstraintColor) const
///
///
public void DrawRodStates(
DebugRenderer renderer,
in float4x4 centerOfMassTransform,
SoftBodyConstraintColor constraintColor
) =>
Jolt.PInvoke.SoftBodyMotionProperties_DrawRodStates(
this,
renderer,
in centerOfMassTransform,
constraintColor
);
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:120
///
/// void DrawRodBendTwistConstraints(DebugRenderer *inRenderer, RMat44Arg inCenterOfMassTransform, ESoftBodyConstraintColor inConstraintColor) const
///
///
public void DrawRodBendTwistConstraints(
DebugRenderer renderer,
in float4x4 centerOfMassTransform,
SoftBodyConstraintColor constraintColor
) =>
Jolt.PInvoke.SoftBodyMotionProperties_DrawRodBendTwistConstraints(
this,
renderer,
in centerOfMassTransform,
constraintColor
);
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:121
///
/// void DrawBendConstraints(DebugRenderer *inRenderer, RMat44Arg inCenterOfMassTransform, ESoftBodyConstraintColor inConstraintColor) const
///
///
public void DrawBendConstraints(
DebugRenderer renderer,
in float4x4 centerOfMassTransform,
SoftBodyConstraintColor constraintColor
) =>
Jolt.PInvoke.SoftBodyMotionProperties_DrawBendConstraints(
this,
renderer,
in centerOfMassTransform,
constraintColor
);
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:122
///
/// void DrawVolumeConstraints(DebugRenderer *inRenderer, RMat44Arg inCenterOfMassTransform, ESoftBodyConstraintColor inConstraintColor) const
///
///
public void DrawVolumeConstraints(
DebugRenderer renderer,
in float4x4 centerOfMassTransform,
SoftBodyConstraintColor constraintColor
) =>
Jolt.PInvoke.SoftBodyMotionProperties_DrawVolumeConstraints(
this,
renderer,
in centerOfMassTransform,
constraintColor
);
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:123
///
/// void DrawSkinConstraints(DebugRenderer *inRenderer, RMat44Arg inCenterOfMassTransform, ESoftBodyConstraintColor inConstraintColor) const
///
///
public void DrawSkinConstraints(
DebugRenderer renderer,
in float4x4 centerOfMassTransform,
SoftBodyConstraintColor constraintColor
) =>
Jolt.PInvoke.SoftBodyMotionProperties_DrawSkinConstraints(
this,
renderer,
in centerOfMassTransform,
constraintColor
);
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:124
///
/// void DrawLRAConstraints(DebugRenderer *inRenderer, RMat44Arg inCenterOfMassTransform, ESoftBodyConstraintColor inConstraintColor) const
///
///
public void DrawLRAConstraints(
DebugRenderer renderer,
in float4x4 centerOfMassTransform,
SoftBodyConstraintColor constraintColor
) =>
Jolt.PInvoke.SoftBodyMotionProperties_DrawLRAConstraints(
this,
renderer,
in centerOfMassTransform,
constraintColor
);
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:125
///
/// void DrawPredictedBounds(DebugRenderer *inRenderer, RMat44Arg inCenterOfMassTransform) const
///
///
public void DrawPredictedBounds(DebugRenderer renderer, in float4x4 centerOfMassTransform) =>
Jolt.PInvoke.SoftBodyMotionProperties_DrawPredictedBounds(this, renderer, in centerOfMassTransform);
///
///
/// Skin vertices to supplied joints, information is used by the skinned constraints.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:140
///
/// void SkinVertices(RMat44Arg inCenterOfMassTransform, const Mat44 *inJointMatrices, uint inNumJoints, bool inHardSkinAll, TempAllocator &ioTempAllocator)
///
///
///
///
/// Skin vertices to supplied joints, information is used by the skinned constraints.
/// @param inCenterOfMassTransform Value of Body::GetCenterOfMassTransform().
/// @param inJointMatrices The joint matrices must be expressed relative to inCenterOfMassTransform.
/// @param inNumJoints Indicates how large the inJointMatrices array is (used only for validating out of bounds).
/// @param inHardSkinAll Can be used to position all vertices on the skinned vertices and can be used to hard reset the soft body.
/// @param ioTempAllocator Allocator.
///
///
/// jointMatrices must hold at least one element per joint the skin's inverse bind matrices reference - 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. Throws
/// InvalidOperationException: "The motion properties have no soft body settings."
///
///
public unsafe void SkinVertices(
in float4x4 centerOfMassTransform,
ReadOnlySpan jointMatrices,
bool hardSkinAll,
TempAllocator tempAllocator
)
{
fixed (float4x4* jointMatrices_fixed = jointMatrices)
{
Jolt.PInvoke.SoftBodyMotionProperties_SkinVertices(
this,
in centerOfMassTransform,
jointMatrices_fixed,
(uint)jointMatrices.Length,
hardSkinAll,
tempAllocator,
out var _bufferCheck
);
if (_bufferCheck == 1)
throw new InvalidOperationException("The motion properties have no soft body settings.");
if (_bufferCheck == 2)
throw new ArgumentOutOfRangeException(
nameof(jointMatrices),
jointMatrices.Length,
"Expected at least one element per joint the skin's inverse bind matrices reference."
);
}
}
///
///
/// This function allows you to update the soft body immediately without going through the PhysicsSystem.
/// This is useful if the soft body is teleported and needs to 'settle' or it can be used if a the soft body
/// is not added to the PhysicsSystem and needs to be updated manually. One reason for not adding it to the
/// PhysicsSystem is that you might want to update a soft body immediately after updating an animated object
/// that has the soft body attached to it. If the soft body is added to the PhysicsSystem it will be updated
/// by it, so calling this function will effectively update it twice. Note that when you use this function,
/// only the current thread will be used, whereas if you update through the PhysicsSystem, multiple threads
/// may be used. Note that this will bypass any sleep checks. Since the dynamic objects that the soft body
/// touches will not move during this call, there can be simulation artifacts if you call this function
/// multiple times without running the physics simulation step.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:153
///
/// void CustomUpdate(float inDeltaTime, Body &ioSoftBody, PhysicsSystem &inSystem)
///
///
public void CustomUpdate(float deltaTime, Body softBody, PhysicsSystem system) =>
Jolt.PInvoke.SoftBodyMotionProperties_CustomUpdate(this, deltaTime, softBody, system);
///
///
/// Initialize the update context. Not part of the public API.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:160
///
/// void InitializeUpdateContext(float inDeltaTime, Body &inSoftBody, const PhysicsSystem &inSystem, SoftBodyUpdateContext &ioContext)
///
///
public void InitializeUpdateContext(
float deltaTime,
Body softBody,
PhysicsSystem system,
SoftBodyUpdateContext context
) => Jolt.PInvoke.SoftBodyMotionProperties_InitializeUpdateContext(this, deltaTime, softBody, system, context);
///
///
/// Do a broad phase check and collect all bodies that can possibly collide with this soft body. Not part of
/// the public API.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:163
///
/// void DetermineCollidingShapes(const SoftBodyUpdateContext &inContext, const PhysicsSystem &inSystem, const BodyLockInterface &inBodyLockInterface)
///
///
public void DetermineCollidingShapes(
SoftBodyUpdateContext context,
PhysicsSystem system,
BodyLockInterface bodyLockInterface
) => Jolt.PInvoke.SoftBodyMotionProperties_DetermineCollidingShapes(this, context, system, bodyLockInterface);
///
///
/// Update the soft body, will process a batch of work. Not part of the public API.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:174
///
/// EStatus ParallelUpdate(SoftBodyUpdateContext &ioContext, const PhysicsSettings &inPhysicsSettings)
///
///
public SoftBodyMotionProperties.Status ParallelUpdate(
SoftBodyUpdateContext context,
in PhysicsSettings physicsSettings
) => Jolt.PInvoke.SoftBodyMotionProperties_ParallelUpdate(this, context, in physicsSettings);
///
///
/// Update the velocities of all rigid bodies that we collided with. Not part of the public API.
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:177
///
/// void UpdateRigidBodyVelocities(const SoftBodyUpdateContext &inContext, BodyInterface &inBodyInterface)
///
///
public void UpdateRigidBodyVelocities(SoftBodyUpdateContext context, BodyInterface bodyInterface) =>
Jolt.PInvoke.SoftBodyMotionProperties_UpdateRigidBodyVelocities(this, context, bodyInterface);
///
///
/// Set a flag to indicate that the ContactListener::OnSoftBodyContactAdded should be called
///
///
/// C++:
/// Jolt/Physics/SoftBody/SoftBodyMotionProperties.h:180
///
/// inline void RequestContactCallback()
///
///
public void RequestContactCallback() => Jolt.PInvoke.SoftBodyMotionProperties_RequestContactCallback(this);
public static implicit operator MotionProperties(SoftBodyMotionProperties value) =>
Unsafe.BitCast(value);
public void Dispose() => Jolt.PInvoke.SoftBodyMotionProperties_Destroy(this);
///
public MotionQuality GetMotionQuality() => ((MotionProperties)this).GetMotionQuality();
///
public AllowedDOFs GetAllowedDOFs() => ((MotionProperties)this).GetAllowedDOFs();
///
public bool GetAllowSleeping() => ((MotionProperties)this).GetAllowSleeping();
///
public float3 GetLinearVelocity() => ((MotionProperties)this).GetLinearVelocity();
///
public void SetLinearVelocity(float3 linearVelocity) =>
((MotionProperties)this).SetLinearVelocity(linearVelocity);
///
public void SetLinearVelocityClamped(float3 linearVelocity) =>
((MotionProperties)this).SetLinearVelocityClamped(linearVelocity);
///
public float3 GetAngularVelocity() => ((MotionProperties)this).GetAngularVelocity();
///
public void SetAngularVelocity(float3 angularVelocity) =>
((MotionProperties)this).SetAngularVelocity(angularVelocity);
///
public void SetAngularVelocityClamped(float3 angularVelocity) =>
((MotionProperties)this).SetAngularVelocityClamped(angularVelocity);
///
public void MoveKinematic(float3 deltaPosition, floatQuat deltaRotation, float deltaTime) =>
((MotionProperties)this).MoveKinematic(deltaPosition, deltaRotation, deltaTime);
///
public float GetMaxLinearVelocity() => ((MotionProperties)this).GetMaxLinearVelocity();
///
public void SetMaxLinearVelocity(float linearVelocity) =>
((MotionProperties)this).SetMaxLinearVelocity(linearVelocity);
///
public float GetMaxAngularVelocity() => ((MotionProperties)this).GetMaxAngularVelocity();
///
public void SetMaxAngularVelocity(float angularVelocity) =>
((MotionProperties)this).SetMaxAngularVelocity(angularVelocity);
///
public void ClampLinearVelocity() => ((MotionProperties)this).ClampLinearVelocity();
///
public void ClampAngularVelocity() => ((MotionProperties)this).ClampAngularVelocity();
///
public float GetLinearDamping() => ((MotionProperties)this).GetLinearDamping();
///
public void SetLinearDamping(float linearDamping) => ((MotionProperties)this).SetLinearDamping(linearDamping);
///
public float GetAngularDamping() => ((MotionProperties)this).GetAngularDamping();
///
public void SetAngularDamping(float angularDamping) =>
((MotionProperties)this).SetAngularDamping(angularDamping);
///
public float GetGravityFactor() => ((MotionProperties)this).GetGravityFactor();
///
public void SetGravityFactor(float gravityFactor) => ((MotionProperties)this).SetGravityFactor(gravityFactor);
///
public void SetMassProperties(AllowedDOFs allowedDOFs, MassProperties massProperties) =>
((MotionProperties)this).SetMassProperties(allowedDOFs, massProperties);
///
public float GetInverseMass() => ((MotionProperties)this).GetInverseMass();
///
public float GetInverseMassUnchecked() => ((MotionProperties)this).GetInverseMassUnchecked();
///
public void SetInverseMass(float inverseMass) => ((MotionProperties)this).SetInverseMass(inverseMass);
///
public float3 GetInverseInertiaDiagonal() => ((MotionProperties)this).GetInverseInertiaDiagonal();
///
public floatQuat GetInertiaRotation() => ((MotionProperties)this).GetInertiaRotation();
///
public void SetInverseInertia(float3 diagonal, floatQuat rot) =>
((MotionProperties)this).SetInverseInertia(diagonal, rot);
///
public void ScaleToMass(float mass) => ((MotionProperties)this).ScaleToMass(mass);
///
public float4x4 GetLocalSpaceInverseInertia() => ((MotionProperties)this).GetLocalSpaceInverseInertia();
///
public float4x4 GetLocalSpaceInverseInertiaUnchecked() =>
((MotionProperties)this).GetLocalSpaceInverseInertiaUnchecked();
///
public float4x4 GetInverseInertiaForRotation(in float4x4 rotation) =>
((MotionProperties)this).GetInverseInertiaForRotation(in rotation);
///
public float3 MultiplyWorldSpaceInverseInertiaByVector(floatQuat bodyRotation, float3 v) =>
((MotionProperties)this).MultiplyWorldSpaceInverseInertiaByVector(bodyRotation, v);
///
public float3 GetPointVelocityCOM(float3 pointRelativeToCOM) =>
((MotionProperties)this).GetPointVelocityCOM(pointRelativeToCOM);
///
public float3 GetAccumulatedForce() => ((MotionProperties)this).GetAccumulatedForce();
///
public float3 GetAccumulatedTorque() => ((MotionProperties)this).GetAccumulatedTorque();
///
public void ResetForce() => ((MotionProperties)this).ResetForce();
///
public void ResetTorque() => ((MotionProperties)this).ResetTorque();
///
public void ResetMotion() => ((MotionProperties)this).ResetMotion();
///
public uint4 GetLinearDOFsMask() => ((MotionProperties)this).GetLinearDOFsMask();
///
public float3 LockTranslation(float3 v) => ((MotionProperties)this).LockTranslation(v);
///
public uint4 GetAngularDOFsMask() => ((MotionProperties)this).GetAngularDOFsMask();
///
public float3 LockAngular(float3 v) => ((MotionProperties)this).LockAngular(v);
///
public void SetNumVelocityStepsOverride(uint n) => ((MotionProperties)this).SetNumVelocityStepsOverride(n);
///
public uint GetNumVelocityStepsOverride() => ((MotionProperties)this).GetNumVelocityStepsOverride();
///
public void SetNumPositionStepsOverride(uint n) => ((MotionProperties)this).SetNumPositionStepsOverride(n);
///
public uint GetNumPositionStepsOverride() => ((MotionProperties)this).GetNumPositionStepsOverride();
///
public void ApplyLinearVelocityStep(float3 linearVelocity) =>
((MotionProperties)this).ApplyLinearVelocityStep(linearVelocity);
///
public void AddLinearVelocityStep(float3 linearVelocityChange) =>
((MotionProperties)this).AddLinearVelocityStep(linearVelocityChange);
///
public void SubLinearVelocityStep(float3 linearVelocityChange) =>
((MotionProperties)this).SubLinearVelocityStep(linearVelocityChange);
///
public void ApplyAngularVelocityStep(float3 angularVelocity) =>
((MotionProperties)this).ApplyAngularVelocityStep(angularVelocity);
///
public void AddAngularVelocityStep(float3 angularVelocityChange) =>
((MotionProperties)this).AddAngularVelocityStep(angularVelocityChange);
///
public void SubAngularVelocityStep(float3 angularVelocityChange) =>
((MotionProperties)this).SubAngularVelocityStep(angularVelocityChange);
///
public void ApplyGyroscopicForceInternal(floatQuat bodyRotation, float deltaTime) =>
((MotionProperties)this).ApplyGyroscopicForceInternal(bodyRotation, deltaTime);
///
public void ApplyForceTorqueAndDragInternal(floatQuat bodyRotation, float3 gravity, float deltaTime) =>
((MotionProperties)this).ApplyForceTorqueAndDragInternal(bodyRotation, gravity, deltaTime);
///
public uint GetIslandIndexInternal() => ((MotionProperties)this).GetIslandIndexInternal();
///
public void SetIslandIndexInternal(uint index) => ((MotionProperties)this).SetIslandIndexInternal(index);
///
public uint GetIndexInActiveBodiesInternal() => ((MotionProperties)this).GetIndexInActiveBodiesInternal();
///
public void ResetSleepTestTimer() => ((MotionProperties)this).ResetSleepTestTimer();
///
public CanSleep AccumulateSleepTime(float deltaTime, float timeBeforeSleep) =>
((MotionProperties)this).AccumulateSleepTime(deltaTime, timeBeforeSleep);
///
public unsafe void ResetSleepTestSpheres(ReadOnlySpan points) =>
((MotionProperties)this).ResetSleepTestSpheres(points);
}
}