// // 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 { /// /// /// 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. /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:35 ///
/// class BodyInterface : public NonCopyable ///
///
[InteropHandle] public readonly partial struct BodyInterface { /// /// /// Initialize the interface (should only be called by PhysicsSystem) /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:39 ///
/// void Init(BodyLockInterface &inBodyLockInterface, BodyManager &inBodyManager, BroadPhase &inBroadPhase) ///
///
public void Init(BodyLockInterface bodyLockInterface, BodyManager bodyManager, BroadPhase broadPhase) => Jolt.PInvoke.BodyInterface_Init(this, bodyLockInterface, bodyManager, broadPhase); /// /// /// Create a rigid body /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:43 ///
/// Body * CreateBody(const BodyCreationSettings &inSettings) ///
///
/// /// /// Create a rigid body /// @return Created body or null when out of bodies /// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// public Body CreateBody(BodyCreationSettings settings) => Jolt.PInvoke.BodyInterface_CreateBody(this, settings); /// /// /// Create a soft body /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:47 ///
/// Body * CreateSoftBody(const SoftBodyCreationSettings &inSettings) ///
///
/// /// /// Create a soft body /// @return Created body or null when out of bodies /// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// public Body CreateSoftBody(SoftBodyCreationSettings settings) => Jolt.PInvoke.BodyInterface_CreateSoftBody(this, settings); /// /// /// 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. /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:52 ///
/// Body * CreateBodyWithID(const BodyID &inBodyID, const BodyCreationSettings &inSettings) ///
///
/// /// /// 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. /// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// public Body CreateBodyWithID(uint bodyID, BodyCreationSettings settings) => Jolt.PInvoke.BodyInterface_CreateBodyWithID(this, bodyID, settings); /// /// /// Create a soft body with specified ID. See comments at CreateBodyWithID. /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:55 ///
/// Body * CreateSoftBodyWithID(const BodyID &inBodyID, const SoftBodyCreationSettings &inSettings) ///
///
/// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// public Body CreateSoftBodyWithID(uint bodyID, SoftBodyCreationSettings settings) => Jolt.PInvoke.BodyInterface_CreateSoftBodyWithID(this, bodyID, settings); /// /// /// 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. /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:60 ///
/// Body * CreateBodyWithoutID(const BodyCreationSettings &inSettings) const ///
///
/// /// /// 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 /// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// public Body CreateBodyWithoutID(BodyCreationSettings settings) => Jolt.PInvoke.BodyInterface_CreateBodyWithoutID(this, settings); /// /// /// Advanced use only. Creates a body without specifying an ID. See comments at CreateBodyWithoutID. /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:63 ///
/// Body * CreateSoftBodyWithoutID(const SoftBodyCreationSettings &inSettings) const ///
///
/// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// public Body CreateSoftBodyWithoutID(SoftBodyCreationSettings settings) => Jolt.PInvoke.BodyInterface_CreateSoftBodyWithoutID(this, settings); /// /// /// 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. /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:67 ///
/// void DestroyBodyWithoutID(Body *inBody) const ///
///
public void DestroyBodyWithoutID(Body body) => Jolt.PInvoke.BodyInterface_DestroyBodyWithoutID(this, body); /// /// /// 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. /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:71 ///
/// bool AssignBodyID(Body *ioBody) ///
///
/// /// /// 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. /// /// public bool AssignBodyID(Body body) => Jolt.PInvoke.BodyInterface_AssignBodyID(this, body); /// /// /// 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. /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:75 ///
/// bool AssignBodyID(Body *ioBody, const BodyID &inBodyID) ///
///
/// /// /// 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. /// /// public bool AssignBodyID(Body body, uint bodyID) => Jolt.PInvoke.BodyInterface_AssignBodyID_2(this, body, bodyID); /// /// /// Advanced use only. See UnassignBodyIDs. Unassigns the ID of a single body. /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:78 ///
/// Body * UnassignBodyID(const BodyID &inBodyID) ///
///
/// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// public Body UnassignBodyID(uint bodyID) => Jolt.PInvoke.BodyInterface_UnassignBodyID(this, bodyID); /// /// /// 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. /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:85 ///
/// void UnassignBodyIDs(const BodyID *inBodyIDs, int inNumber, Body **outBodies) ///
///
/// /// /// 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). /// /// /// 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. /// /// /// bodies is a buffer of Body handles you allocate and size, read by the call. /// /// public unsafe void UnassignBodyIDs(ReadOnlySpan bodyIDs, Ptr bodies) { fixed (uint* bodyIDs_fixed = bodyIDs) { Jolt.PInvoke.BodyInterface_UnassignBodyIDs(this, bodyIDs_fixed, (int)bodyIDs.Length, bodies); } } /// /// /// Destroy a body. Make sure that you remove the body from the physics system using /// BodyInterface::RemoveBody before calling this function. /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:89 ///
/// void DestroyBody(const BodyID &inBodyID) ///
///
public void DestroyBody(uint bodyID) => Jolt.PInvoke.BodyInterface_DestroyBody(this, bodyID); /// /// /// Destroy multiple bodies Make sure that you remove the bodies from the physics system using /// BodyInterface::RemoveBody before calling this function. /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:93 ///
/// void DestroyBodies(const BodyID *inBodyIDs, int inNumber) ///
///
/// /// /// 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. /// /// public unsafe void DestroyBodies(ReadOnlySpan bodyIDs) { fixed (uint* bodyIDs_fixed = bodyIDs) { Jolt.PInvoke.BodyInterface_DestroyBodies(this, bodyIDs_fixed, (int)bodyIDs.Length); } } /// /// /// 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! /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:99 ///
/// void AddBody(const BodyID &inBodyID, EActivation inActivationMode) ///
///
public void AddBody(uint bodyID, Activation activationMode) => Jolt.PInvoke.BodyInterface_AddBody(this, bodyID, activationMode); /// /// /// Remove body from the physics system. Note that you need to add a body to the physics system before you /// can remove it. /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:102 ///
/// void RemoveBody(const BodyID &inBodyID) ///
///
public void RemoveBody(uint bodyID) => Jolt.PInvoke.BodyInterface_RemoveBody(this, bodyID); /// /// /// Check if a body has been added to the physics system. /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:105 ///
/// bool IsAdded(const BodyID &inBodyID) const ///
///
public bool IsAdded(uint bodyID) => Jolt.PInvoke.BodyInterface_IsAdded(this, bodyID); /// /// /// Combines CreateBody and AddBody /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:109 ///
/// BodyID CreateAndAddBody(const BodyCreationSettings &inSettings, EActivation inActivationMode) ///
///
/// /// /// Combines CreateBody and AddBody /// @return Created body ID or an invalid ID when out of bodies /// /// public uint CreateAndAddBody(BodyCreationSettings settings, Activation activationMode) => Jolt.PInvoke.BodyInterface_CreateAndAddBody(this, settings, activationMode); /// /// /// Combines CreateSoftBody and AddBody /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:113 ///
/// BodyID CreateAndAddSoftBody(const SoftBodyCreationSettings &inSettings, EActivation inActivationMode) ///
///
/// /// /// Combines CreateSoftBody and AddBody /// @return Created body ID or an invalid ID when out of bodies /// /// public uint CreateAndAddSoftBody(SoftBodyCreationSettings settings, Activation activationMode) => Jolt.PInvoke.BodyInterface_CreateAndAddSoftBody(this, settings, activationMode); /// /// /// 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. /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:137 ///
/// void RemoveBodies(BodyID *ioBodies, int inNumber) ///
///
/// /// /// 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. /// /// public unsafe void RemoveBodies(Span bodies) { fixed (uint* bodies_fixed = bodies) { Jolt.PInvoke.BodyInterface_RemoveBodies(this, bodies_fixed, (int)bodies.Length); } } /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:142 ///
/// void ActivateBody(const BodyID &inBodyID) ///
///
/// /// /// @name Activate / deactivate a body. Note that you need to add a body to the physics system before you can activate it. /// @{ /// /// public void ActivateBody(uint bodyID) => Jolt.PInvoke.BodyInterface_ActivateBody(this, bodyID); /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:143 ///
/// void ActivateBodies(const BodyID *inBodyIDs, int inNumber) ///
///
/// /// /// 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. /// /// public unsafe void ActivateBodies(ReadOnlySpan bodyIDs) { fixed (uint* bodyIDs_fixed = bodyIDs) { Jolt.PInvoke.BodyInterface_ActivateBodies(this, bodyIDs_fixed, (int)bodyIDs.Length); } } /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:144 ///
/// void ActivateBodiesInAABox(const AABox &inBox, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter) ///
///
/// /// /// Pass default for broadPhaseLayerFilter to filter nothing out. /// /// /// Pass default for objectLayerFilter to filter nothing out. /// /// public void ActivateBodiesInAABox( in AABox box, BroadPhaseLayerFilter broadPhaseLayerFilter, ObjectLayerFilter objectLayerFilter ) => Jolt.PInvoke.BodyInterface_ActivateBodiesInAABox(this, in box, broadPhaseLayerFilter, objectLayerFilter); /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:145 ///
/// void DeactivateBody(const BodyID &inBodyID) ///
///
public void DeactivateBody(uint bodyID) => Jolt.PInvoke.BodyInterface_DeactivateBody(this, bodyID); /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:146 ///
/// void DeactivateBodies(const BodyID *inBodyIDs, int inNumber) ///
///
/// /// /// 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. /// /// public unsafe void DeactivateBodies(ReadOnlySpan bodyIDs) { fixed (uint* bodyIDs_fixed = bodyIDs) { Jolt.PInvoke.BodyInterface_DeactivateBodies(this, bodyIDs_fixed, (int)bodyIDs.Length); } } /// /// /// Checks if a body is currently actively simulating /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:147 ///
/// bool IsActive(const BodyID &inBodyID) const ///
///
public bool IsActive(uint bodyID) => Jolt.PInvoke.BodyInterface_IsActive(this, bodyID); /// /// /// @see Body::ResetSleepTimer /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:148 ///
/// void ResetSleepTimer(const BodyID &inBodyID) ///
///
public void ResetSleepTimer(uint bodyID) => Jolt.PInvoke.BodyInterface_ResetSleepTimer(this, bodyID); /// /// /// Create a two body constraint /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:152 ///
/// TwoBodyConstraint * CreateConstraint(const TwoBodyConstraintSettings *inSettings, const BodyID &inBodyID1, const BodyID &inBodyID2) ///
///
/// /// /// The returned handle carries its own reference; Dispose it once when you're done. /// /// public TwoBodyConstraint CreateConstraint(TwoBodyConstraintSettings settings, uint bodyID1, uint bodyID2) => Jolt.PInvoke.BodyInterface_CreateConstraint(this, settings, bodyID1, bodyID2); /// /// /// 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. /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:156 ///
/// void ActivateConstraint(const TwoBodyConstraint *inConstraint) ///
///
public void ActivateConstraint(TwoBodyConstraint constraint) => Jolt.PInvoke.BodyInterface_ActivateConstraint(this, constraint); /// /// /// Get the current shape /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:162 ///
/// RefConst<Shape> GetShape(const BodyID &inBodyID) const ///
///
/// /// /// The returned handle carries its own reference; Dispose it once when you're done. /// /// public Shape GetShape(uint bodyID) => Jolt.PInvoke.BodyInterface_GetShape(this, bodyID); /// /// /// Set a new shape on the body /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:169 ///
/// void SetShape(const BodyID &inBodyID, const Shape *inShape, bool inUpdateMassProperties, EActivation inActivationMode) const ///
///
/// /// /// 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 /// /// public void SetShape(uint bodyID, Shape shape, bool updateMassProperties, Activation activationMode) => Jolt.PInvoke.BodyInterface_SetShape(this, bodyID, shape, updateMassProperties, activationMode); /// /// /// Notify all systems to indicate that a shape has changed (usable for MutableCompoundShapes) /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:176 ///
/// void NotifyShapeChanged(const BodyID &inBodyID, Vec3Arg inPreviousCenterOfMass, bool inUpdateMassProperties, EActivation inActivationMode) const ///
///
/// /// /// 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 /// /// public void NotifyShapeChanged( uint bodyID, float3 previousCenterOfMass, bool updateMassProperties, Activation activationMode ) => Jolt.PInvoke.BodyInterface_NotifyShapeChanged( this, bodyID, previousCenterOfMass, updateMassProperties, activationMode ); /// /// /// The collision layer this body belongs to (determines if two objects can collide) /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:181 ///
/// void SetObjectLayer(const BodyID &inBodyID, ObjectLayer inLayer) ///
///
/// /// /// @name Object layer of a body /// @{ /// /// public void SetObjectLayer(uint bodyID, ushort layer) => Jolt.PInvoke.BodyInterface_SetObjectLayer(this, bodyID, layer); /// /// /// @see Body::GetObjectLayer /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:182 ///
/// ObjectLayer GetObjectLayer(const BodyID &inBodyID) const ///
///
public ushort GetObjectLayer(uint bodyID) => Jolt.PInvoke.BodyInterface_GetObjectLayer(this, bodyID); /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:187 ///
/// void SetPositionAndRotation(const BodyID &inBodyID, RVec3Arg inPosition, QuatArg inRotation, EActivation inActivationMode) ///
///
/// /// /// @name Position and rotation of a body /// @{ /// /// public void SetPositionAndRotation( uint bodyID, float3 position, floatQuat rotation, Activation activationMode ) => Jolt.PInvoke.BodyInterface_SetPositionAndRotation(this, bodyID, position, rotation, activationMode); /// /// /// 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. /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:188 ///
/// void SetPositionAndRotationWhenChanged(const BodyID &inBodyID, RVec3Arg inPosition, QuatArg inRotation, EActivation inActivationMode) ///
///
public void SetPositionAndRotationWhenChanged( uint bodyID, float3 position, floatQuat rotation, Activation activationMode ) => Jolt.PInvoke.BodyInterface_SetPositionAndRotationWhenChanged( this, bodyID, position, rotation, activationMode ); /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:189 ///
/// void GetPositionAndRotation(const BodyID &inBodyID, RVec3 &outPosition, Quat &outRotation) const ///
///
public void GetPositionAndRotation(uint bodyID, out float3 position, out floatQuat rotation) => Jolt.PInvoke.BodyInterface_GetPositionAndRotation(this, bodyID, out position, out rotation); /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:190 ///
/// void SetPosition(const BodyID &inBodyID, RVec3Arg inPosition, EActivation inActivationMode) ///
///
public void SetPosition(uint bodyID, float3 position, Activation activationMode) => Jolt.PInvoke.BodyInterface_SetPosition(this, bodyID, position, activationMode); /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:191 ///
/// RVec3 GetPosition(const BodyID &inBodyID) const ///
///
public float3 GetPosition(uint bodyID) => Jolt.PInvoke.BodyInterface_GetPosition(this, bodyID); /// /// /// @see Body::GetCenterOfMassPosition /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:192 ///
/// RVec3 GetCenterOfMassPosition(const BodyID &inBodyID) const ///
///
public float3 GetCenterOfMassPosition(uint bodyID) => Jolt.PInvoke.BodyInterface_GetCenterOfMassPosition(this, bodyID); /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:193 ///
/// void SetRotation(const BodyID &inBodyID, QuatArg inRotation, EActivation inActivationMode) ///
///
public void SetRotation(uint bodyID, floatQuat rotation, Activation activationMode) => Jolt.PInvoke.BodyInterface_SetRotation(this, bodyID, rotation, activationMode); /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:194 ///
/// Quat GetRotation(const BodyID &inBodyID) const ///
///
public floatQuat GetRotation(uint bodyID) => Jolt.PInvoke.BodyInterface_GetRotation(this, bodyID); /// /// /// @see Body::GetWorldTransform /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:195 ///
/// RMat44 GetWorldTransform(const BodyID &inBodyID) const ///
///
public float4x4 GetWorldTransform(uint bodyID) => Jolt.PInvoke.BodyInterface_GetWorldTransform(this, bodyID); /// /// /// @see Body::GetCenterOfMassTransform /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:196 ///
/// RMat44 GetCenterOfMassTransform(const BodyID &inBodyID) const ///
///
public float4x4 GetCenterOfMassTransform(uint bodyID) => Jolt.PInvoke.BodyInterface_GetCenterOfMassTransform(this, bodyID); /// /// /// Set velocity of body such that it will be positioned at inTargetPosition/Rotation in inDeltaTime seconds /// (will activate body if needed) /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:200 ///
/// void MoveKinematic(const BodyID &inBodyID, RVec3Arg inTargetPosition, QuatArg inTargetRotation, float inDeltaTime) ///
///
public void MoveKinematic(uint bodyID, float3 targetPosition, floatQuat targetRotation, float deltaTime) => Jolt.PInvoke.BodyInterface_MoveKinematic(this, bodyID, targetPosition, targetRotation, deltaTime); /// /// /// 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$ /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:204 ///
/// void SetLinearAndAngularVelocity(const BodyID &inBodyID, Vec3Arg inLinearVelocity, Vec3Arg inAngularVelocity) ///
///
public void SetLinearAndAngularVelocity(uint bodyID, float3 linearVelocity, float3 angularVelocity) => Jolt.PInvoke.BodyInterface_SetLinearAndAngularVelocity(this, bodyID, linearVelocity, angularVelocity); /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:205 ///
/// void GetLinearAndAngularVelocity(const BodyID &inBodyID, Vec3 &outLinearVelocity, Vec3 &outAngularVelocity) const ///
///
public void GetLinearAndAngularVelocity(uint bodyID, out float3 linearVelocity, out float3 angularVelocity) => Jolt.PInvoke.BodyInterface_GetLinearAndAngularVelocity( this, bodyID, out linearVelocity, out angularVelocity ); /// /// /// @see Body::SetLinearVelocity /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:206 ///
/// void SetLinearVelocity(const BodyID &inBodyID, Vec3Arg inLinearVelocity) ///
///
public void SetLinearVelocity(uint bodyID, float3 linearVelocity) => Jolt.PInvoke.BodyInterface_SetLinearVelocity(this, bodyID, linearVelocity); /// /// /// @see Body::GetLinearVelocity /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:207 ///
/// Vec3 GetLinearVelocity(const BodyID &inBodyID) const ///
///
public float3 GetLinearVelocity(uint bodyID) => Jolt.PInvoke.BodyInterface_GetLinearVelocity(this, bodyID); /// /// /// Add velocity to current velocity /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:208 ///
/// void AddLinearVelocity(const BodyID &inBodyID, Vec3Arg inLinearVelocity) ///
///
public void AddLinearVelocity(uint bodyID, float3 linearVelocity) => Jolt.PInvoke.BodyInterface_AddLinearVelocity(this, bodyID, linearVelocity); /// /// /// Add linear and angular to current velocities /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:209 ///
/// void AddLinearAndAngularVelocity(const BodyID &inBodyID, Vec3Arg inLinearVelocity, Vec3Arg inAngularVelocity) ///
///
public void AddLinearAndAngularVelocity(uint bodyID, float3 linearVelocity, float3 angularVelocity) => Jolt.PInvoke.BodyInterface_AddLinearAndAngularVelocity(this, bodyID, linearVelocity, angularVelocity); /// /// /// @see Body::SetAngularVelocity /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:210 ///
/// void SetAngularVelocity(const BodyID &inBodyID, Vec3Arg inAngularVelocity) ///
///
public void SetAngularVelocity(uint bodyID, float3 angularVelocity) => Jolt.PInvoke.BodyInterface_SetAngularVelocity(this, bodyID, angularVelocity); /// /// /// @see Body::GetAngularVelocity /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:211 ///
/// Vec3 GetAngularVelocity(const BodyID &inBodyID) const ///
///
public float3 GetAngularVelocity(uint bodyID) => Jolt.PInvoke.BodyInterface_GetAngularVelocity(this, bodyID); /// /// /// Velocity of point inPoint (in world space, e.g. on the surface of the body) of the body. @see /// Body::GetPointVelocity /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:212 ///
/// Vec3 GetPointVelocity(const BodyID &inBodyID, RVec3Arg inPoint) const ///
///
public float3 GetPointVelocity(uint bodyID, float3 point) => Jolt.PInvoke.BodyInterface_GetPointVelocity(this, bodyID, point); /// /// /// 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$ /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:216 ///
/// void SetPositionRotationAndVelocity(const BodyID &inBodyID, RVec3Arg inPosition, QuatArg inRotation, Vec3Arg inLinearVelocity, Vec3Arg inAngularVelocity) ///
///
public void SetPositionRotationAndVelocity( uint bodyID, float3 position, floatQuat rotation, float3 linearVelocity, float3 angularVelocity ) => Jolt.PInvoke.BodyInterface_SetPositionRotationAndVelocity( this, bodyID, position, rotation, linearVelocity, angularVelocity ); /// /// /// @see Body::AddForce /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:220 ///
/// void AddForce(const BodyID &inBodyID, Vec3Arg inForce, EActivation inActivationMode = EActivation::Activate) ///
///
/// /// /// @name Add forces to the body. Note that you should add a body to the physics system before applying forces or torques. /// @{ /// /// public void AddForce(uint bodyID, float3 force, Activation activationMode = Activation.Activate) => Jolt.PInvoke.BodyInterface_AddForce(this, bodyID, force, activationMode); /// /// /// Applied at world space position inPoint. @see Body::AddForce /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:221 ///
/// void AddForce(const BodyID &inBodyID, Vec3Arg inForce, RVec3Arg inPoint, EActivation inActivationMode = EActivation::Activate) ///
///
public void AddForce( uint bodyID, float3 force, float3 point, Activation activationMode = Activation.Activate ) => Jolt.PInvoke.BodyInterface_AddForce_2(this, bodyID, force, point, activationMode); /// /// /// @see Body::AddTorque /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:222 ///
/// void AddTorque(const BodyID &inBodyID, Vec3Arg inTorque, EActivation inActivationMode = EActivation::Activate) ///
///
public void AddTorque(uint bodyID, float3 torque, Activation activationMode = Activation.Activate) => Jolt.PInvoke.BodyInterface_AddTorque(this, bodyID, torque, activationMode); /// /// /// A combination of Body::AddForce and Body::AddTorque /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:223 ///
/// void AddForceAndTorque(const BodyID &inBodyID, Vec3Arg inForce, Vec3Arg inTorque, EActivation inActivationMode = EActivation::Activate) ///
///
public void AddForceAndTorque( uint bodyID, float3 force, float3 torque, Activation activationMode = Activation.Activate ) => Jolt.PInvoke.BodyInterface_AddForceAndTorque(this, bodyID, force, torque, activationMode); /// /// /// Applied at center of mass. @see Body::AddImpulse /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:228 ///
/// void AddImpulse(const BodyID &inBodyID, Vec3Arg inImpulse) ///
///
/// /// /// @name Add an impulse to the body. Note that you should add a body to the physics system before applying impulses. /// @{ /// /// public void AddImpulse(uint bodyID, float3 impulse) => Jolt.PInvoke.BodyInterface_AddImpulse(this, bodyID, impulse); /// /// /// Applied at world space position inPoint. @see Body::AddImpulse /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:229 ///
/// void AddImpulse(const BodyID &inBodyID, Vec3Arg inImpulse, RVec3Arg inPoint) ///
///
public void AddImpulse(uint bodyID, float3 impulse, float3 point) => Jolt.PInvoke.BodyInterface_AddImpulse_2(this, bodyID, impulse, point); /// /// /// @see Body::AddAngularImpulse /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:230 ///
/// void AddAngularImpulse(const BodyID &inBodyID, Vec3Arg inAngularImpulse) ///
///
public void AddAngularImpulse(uint bodyID, float3 angularImpulse) => Jolt.PInvoke.BodyInterface_AddAngularImpulse(this, bodyID, angularImpulse); /// /// /// @see Body::ApplyBuoyancyImpulse /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:231 ///
/// bool ApplyBuoyancyImpulse(const BodyID &inBodyID, RVec3Arg inSurfacePosition, Vec3Arg inSurfaceNormal, float inBuoyancy, float inLinearDrag, float inAngularDrag, Vec3Arg inFluidVelocity, Vec3Arg inGravity, float inDeltaTime) ///
///
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 ); /// /// /// @see Body::GetBodyType /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:236 ///
/// EBodyType GetBodyType(const BodyID &inBodyID) const ///
///
/// /// /// @name Body type /// @{ /// /// public BodyType GetBodyType(uint bodyID) => Jolt.PInvoke.BodyInterface_GetBodyType(this, bodyID); /// /// /// @see Body::SetMotionType /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:241 ///
/// void SetMotionType(const BodyID &inBodyID, EMotionType inMotionType, EActivation inActivationMode) ///
///
/// /// /// @name Body motion type /// @{ /// /// public void SetMotionType(uint bodyID, MotionType motionType, Activation activationMode) => Jolt.PInvoke.BodyInterface_SetMotionType(this, bodyID, motionType, activationMode); /// /// /// @see Body::GetMotionType /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:242 ///
/// EMotionType GetMotionType(const BodyID &inBodyID) const ///
///
public MotionType GetMotionType(uint bodyID) => Jolt.PInvoke.BodyInterface_GetMotionType(this, bodyID); /// /// /// How well it detects collisions when it has a high velocity /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:247 ///
/// void SetMotionQuality(const BodyID &inBodyID, EMotionQuality inMotionQuality) ///
///
/// /// /// @name Body motion quality /// @{ /// /// public void SetMotionQuality(uint bodyID, MotionQuality motionQuality) => Jolt.PInvoke.BodyInterface_SetMotionQuality(this, bodyID, motionQuality); /// /// /// @see MotionProperties::GetMotionQuality /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:248 ///
/// EMotionQuality GetMotionQuality(const BodyID &inBodyID) const ///
///
public MotionQuality GetMotionQuality(uint bodyID) => Jolt.PInvoke.BodyInterface_GetMotionQuality(this, bodyID); /// /// /// @see Body::GetInverseInertia /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:252 ///
/// Mat44 GetInverseInertia(const BodyID &inBodyID) const ///
///
/// /// /// Get inverse inertia tensor in world space /// /// public float4x4 GetInverseInertia(uint bodyID) => Jolt.PInvoke.BodyInterface_GetInverseInertia(this, bodyID); /// /// /// @see Body::SetRestitution /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:256 ///
/// void SetRestitution(const BodyID &inBodyID, float inRestitution) ///
///
/// /// /// @name Restitution /// @{ /// /// public void SetRestitution(uint bodyID, float restitution) => Jolt.PInvoke.BodyInterface_SetRestitution(this, bodyID, restitution); /// /// /// @see Body::GetRestitution /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:257 ///
/// float GetRestitution(const BodyID &inBodyID) const ///
///
public float GetRestitution(uint bodyID) => Jolt.PInvoke.BodyInterface_GetRestitution(this, bodyID); /// /// /// @see Body::SetFriction /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:262 ///
/// void SetFriction(const BodyID &inBodyID, float inFriction) ///
///
/// /// /// @name Friction /// @{ /// /// public void SetFriction(uint bodyID, float friction) => Jolt.PInvoke.BodyInterface_SetFriction(this, bodyID, friction); /// /// /// @see Body::GetFriction /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:263 ///
/// float GetFriction(const BodyID &inBodyID) const ///
///
public float GetFriction(uint bodyID) => Jolt.PInvoke.BodyInterface_GetFriction(this, bodyID); /// /// /// @see MotionProperties::SetGravityFactor /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:268 ///
/// void SetGravityFactor(const BodyID &inBodyID, float inGravityFactor) ///
///
/// /// /// @name Gravity factor /// @{ /// /// public void SetGravityFactor(uint bodyID, float gravityFactor) => Jolt.PInvoke.BodyInterface_SetGravityFactor(this, bodyID, gravityFactor); /// /// /// @see MotionProperties::GetGravityFactor /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:269 ///
/// float GetGravityFactor(const BodyID &inBodyID) const ///
///
public float GetGravityFactor(uint bodyID) => Jolt.PInvoke.BodyInterface_GetGravityFactor(this, bodyID); /// /// /// @see MotionProperties::SetMaxLinearVelocity /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:274 ///
/// void SetMaxLinearVelocity(const BodyID &inBodyID, float inLinearVelocity) ///
///
/// /// /// @name Max linear velocity /// @{ /// /// public void SetMaxLinearVelocity(uint bodyID, float linearVelocity) => Jolt.PInvoke.BodyInterface_SetMaxLinearVelocity(this, bodyID, linearVelocity); /// /// /// @see MotionProperties::GetMaxLinearVelocity /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:275 ///
/// float GetMaxLinearVelocity(const BodyID &inBodyID) const ///
///
public float GetMaxLinearVelocity(uint bodyID) => Jolt.PInvoke.BodyInterface_GetMaxLinearVelocity(this, bodyID); /// /// /// @see MotionProperties::SetMaxAngularVelocity /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:280 ///
/// void SetMaxAngularVelocity(const BodyID &inBodyID, float inAngularVelocity) ///
///
/// /// /// @name Max angular velocity /// @{ /// /// public void SetMaxAngularVelocity(uint bodyID, float angularVelocity) => Jolt.PInvoke.BodyInterface_SetMaxAngularVelocity(this, bodyID, angularVelocity); /// /// /// @see MotionProperties::GetMaxAngularVelocity /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:281 ///
/// float GetMaxAngularVelocity(const BodyID &inBodyID) const ///
///
public float GetMaxAngularVelocity(uint bodyID) => Jolt.PInvoke.BodyInterface_GetMaxAngularVelocity(this, bodyID); /// /// /// @see Body::SetUseManifoldReduction /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:286 ///
/// void SetUseManifoldReduction(const BodyID &inBodyID, bool inUseReduction) ///
///
/// /// /// @name Manifold reduction /// @{ /// /// public void SetUseManifoldReduction(uint bodyID, bool useReduction) => Jolt.PInvoke.BodyInterface_SetUseManifoldReduction(this, bodyID, useReduction); /// /// /// @see Body::GetUseManifoldReduction /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:287 ///
/// bool GetUseManifoldReduction(const BodyID &inBodyID) const ///
///
public bool GetUseManifoldReduction(uint bodyID) => Jolt.PInvoke.BodyInterface_GetUseManifoldReduction(this, bodyID); /// /// /// @see Body::SetIsSensor /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:292 ///
/// void SetIsSensor(const BodyID &inBodyID, bool inIsSensor) ///
///
/// /// /// @name Sensor /// @{ /// /// public void SetIsSensor(uint bodyID, bool isSensor) => Jolt.PInvoke.BodyInterface_SetIsSensor(this, bodyID, isSensor); /// /// /// @see Body::IsSensor /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:293 ///
/// bool IsSensor(const BodyID &inBodyID) const ///
///
public bool IsSensor(uint bodyID) => Jolt.PInvoke.BodyInterface_IsSensor(this, bodyID); /// /// /// @see Body::SetCollisionGroup /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:298 ///
/// void SetCollisionGroup(const BodyID &inBodyID, const CollisionGroup &inCollisionGroup) ///
///
/// /// /// @name Collision group /// @{ /// /// public void SetCollisionGroup(uint bodyID, CollisionGroup collisionGroup) => Jolt.PInvoke.BodyInterface_SetCollisionGroup(this, bodyID, collisionGroup); /// /// /// @see Body::GetCollisionGroup /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:299 ///
/// const CollisionGroup & GetCollisionGroup(const BodyID &inBodyID) const ///
///
/// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// public CollisionGroup GetCollisionGroup(uint bodyID) => Jolt.PInvoke.BodyInterface_GetCollisionGroup(this, bodyID); /// /// /// Get transform and shape for this body, used to perform collision detection /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:303 ///
/// TransformedShape GetTransformedShape(const BodyID &inBodyID) const ///
///
/// /// /// The returned handle is an owned copy; Dispose it when you're done with it. /// /// public TransformedShape GetTransformedShape(uint bodyID) => Jolt.PInvoke.BodyInterface_GetTransformedShape(this, bodyID); /// /// /// Get the user data for a body /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:306 ///
/// uint64 GetUserData(const BodyID &inBodyID) const ///
///
public ulong GetUserData(uint bodyID) => Jolt.PInvoke.BodyInterface_GetUserData(this, bodyID); /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:307 ///
/// void SetUserData(const BodyID &inBodyID, uint64 inUserData) const ///
///
public void SetUserData(uint bodyID, ulong userData) => Jolt.PInvoke.BodyInterface_SetUserData(this, bodyID, userData); /// /// /// Get the material for a particular sub shape /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:310 ///
/// const PhysicsMaterial * GetMaterial(const BodyID &inBodyID, const SubShapeID &inSubShapeID) const ///
///
/// /// /// The returned handle carries its own reference; Dispose it once when you're done. /// /// public PhysicsMaterial GetMaterial(uint bodyID, uint subShapeID) => Jolt.PInvoke.BodyInterface_GetMaterial(this, bodyID, subShapeID); /// /// /// 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. /// /// /// C++: /// Jolt/Physics/Body/BodyInterface.h:313 ///
/// void InvalidateContactCache(const BodyID &inBodyID) ///
///
public void InvalidateContactCache(uint bodyID) => Jolt.PInvoke.BodyInterface_InvalidateContactCache(this, bodyID); /// /// /// 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. /// /// public unsafe void SetPositionsAndRotations( ReadOnlySpan bodyIDs, ReadOnlySpan positions, ReadOnlySpan 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 ); } } /// /// /// 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. /// /// public unsafe void SetPositionsAndRotationsWhenChanged( ReadOnlySpan bodyIDs, ReadOnlySpan positions, ReadOnlySpan 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 ); } } /// /// /// 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. /// /// public unsafe void MoveKinematics( ReadOnlySpan bodyIDs, ReadOnlySpan positions, ReadOnlySpan 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 ); } } /// /// /// 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. /// /// public unsafe void SetLinearAndAngularVelocities( ReadOnlySpan bodyIDs, ReadOnlySpan linearVelocities, ReadOnlySpan 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 ); } } /// /// /// 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. /// /// public unsafe void AddForces( ReadOnlySpan bodyIDs, ReadOnlySpan 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 ); } } /// /// /// 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. /// /// public unsafe void AddImpulses(ReadOnlySpan bodyIDs, ReadOnlySpan 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 ); } } } }