//
// Generated by Brutal.Jolt.Generate; do not edit by hand.
#nullable enable
using Brutal.Interop;
using Brutal.Numerics;
namespace Brutal.JoltApi
{
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:46
///
/// class BodyManager : public NonCopyable
///
///
///
///
/// Class that contains all bodies
///
/// WARNING: This class is an internal part of PhysicsSystem, it has no functions that can be called by users of the library.
/// Its functionality is exposed through PhysicsSystem, BodyInterface, BodyLockRead and BodyLockWrite.
///
///
[InteropHandle]
public readonly partial struct BodyManager
{
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:222
///
/// enum class EShapeColor
///
///
public enum EShapeColor : int
{
///
///
/// Random color per instance
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:224
///
/// InstanceColor
///
///
InstanceColor,
///
///
/// Convex = green, scaled = yellow, compound = orange, mesh = red
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:225
///
/// ShapeTypeColor
///
///
ShapeTypeColor,
///
///
/// Static = grey, keyframed = green, dynamic = random color per instance
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:226
///
/// MotionTypeColor
///
///
MotionTypeColor,
///
///
/// Static = grey, keyframed = green, dynamic = yellow, sleeping = red
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:227
///
/// SleepColor
///
///
SleepColor,
///
///
/// Static = grey, active = random color per island, sleeping = light grey
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:228
///
/// IslandColor
///
///
IslandColor,
///
///
/// Color as defined by the PhysicsMaterial of the shape
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:229
///
/// MaterialColor
///
///
MaterialColor,
}
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:64
///
/// struct BodyStats
///
///
///
///
/// Helper struct that counts the number of bodies of each type
///
///
[StructLayout(LayoutKind.Explicit, Size = 36)]
public struct BodyStats
{
///
///
/// Total number of bodies in the body manager
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:66
///
/// uint mNumBodies = 0
///
///
[FieldOffset(0)]
public uint mNumBodies;
///
///
/// Max allowed number of bodies in the body manager (as configured in Init(...))
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:67
///
/// uint mMaxBodies = 0
///
///
[FieldOffset(4)]
public uint mMaxBodies;
///
///
/// Number of static bodies
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:69
///
/// uint mNumBodiesStatic = 0
///
///
[FieldOffset(8)]
public uint mNumBodiesStatic;
///
///
/// Number of dynamic bodies
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:71
///
/// uint mNumBodiesDynamic = 0
///
///
[FieldOffset(12)]
public uint mNumBodiesDynamic;
///
///
/// Number of dynamic bodies that are currently active
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:72
///
/// uint mNumActiveBodiesDynamic = 0
///
///
[FieldOffset(16)]
public uint mNumActiveBodiesDynamic;
///
///
/// Number of kinematic bodies
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:74
///
/// uint mNumBodiesKinematic = 0
///
///
[FieldOffset(20)]
public uint mNumBodiesKinematic;
///
///
/// Number of kinematic bodies that are currently active
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:75
///
/// uint mNumActiveBodiesKinematic = 0
///
///
[FieldOffset(24)]
public uint mNumActiveBodiesKinematic;
///
///
/// Number of soft bodies
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:77
///
/// uint mNumSoftBodies = 0
///
///
[FieldOffset(28)]
public uint mNumSoftBodies;
///
///
/// Number of soft bodies that are currently active
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:78
///
/// uint mNumActiveSoftBodies = 0
///
///
[FieldOffset(32)]
public uint mNumActiveSoftBodies;
}
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:243
///
/// struct DrawSettings
///
///
///
///
/// Draw settings
///
/// Note that there are several debug drawing features that are not exposed through this interface since they use information
/// that is only available deep inside the simulation update and are mostly there to facilitate debugging Jolt. These options
/// use DebugRenderer::sInstance to draw.
///
/// E.g.:
/// * To draw contact information, use ContactConstraintManager::sDrawContactManifolds.
/// * To draw when continuous collision detection is used, use PhysicsSystem::sDrawMotionQualityLinearCast.
/// * To draw what's going on in a CharacterVirtual update, use CharacterVirtual::sDrawConstraints, CharacterVirtual::sDrawWalkStairs and CharacterVirtual::sDrawStickToFloor.
/// * To draw the volume of water that interacts with a shape, use Shape::sDrawSubmergedVolumes.
///
///
[StructLayout(LayoutKind.Explicit, Size = 36)]
public struct DrawSettings
{
///
///
/// Draw the GetSupport() function, used for convex collision detection
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:245
///
/// bool mDrawGetSupportFunction = false
///
///
[FieldOffset(0)]
public Brutal.Bool8 mDrawGetSupportFunction;
///
///
/// When drawing the support function, also draw which direction mapped to a specific support point
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:246
///
/// bool mDrawSupportDirection = false
///
///
[FieldOffset(1)]
public Brutal.Bool8 mDrawSupportDirection;
///
///
/// Draw the faces that were found colliding during collision detection
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:247
///
/// bool mDrawGetSupportingFace = false
///
///
[FieldOffset(2)]
public Brutal.Bool8 mDrawGetSupportingFace;
///
///
/// Draw the shapes of all bodies
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:248
///
/// bool mDrawShape = true
///
///
[FieldOffset(3)]
public Brutal.Bool8 mDrawShape;
///
///
/// When mDrawShape is true and this is true, the shapes will be drawn in wireframe instead of solid.
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:249
///
/// bool mDrawShapeWireframe = false
///
///
[FieldOffset(4)]
public Brutal.Bool8 mDrawShapeWireframe;
///
///
/// Coloring scheme to use for shapes
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:250
///
/// EShapeColor mDrawShapeColor = EShapeColor::MotionTypeColor
///
///
[FieldOffset(8)]
public BodyManager.EShapeColor mDrawShapeColor;
///
///
/// Draw a bounding box per body
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:251
///
/// bool mDrawBoundingBox = false
///
///
[FieldOffset(12)]
public Brutal.Bool8 mDrawBoundingBox;
///
///
/// Draw the center of mass for each body
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:252
///
/// bool mDrawCenterOfMassTransform = false
///
///
[FieldOffset(13)]
public Brutal.Bool8 mDrawCenterOfMassTransform;
///
///
/// Draw the world transform (which can be different than the center of mass) for each body
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:253
///
/// bool mDrawWorldTransform = false
///
///
[FieldOffset(14)]
public Brutal.Bool8 mDrawWorldTransform;
///
///
/// Draw the velocity vector for each body
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:254
///
/// bool mDrawVelocity = false
///
///
[FieldOffset(15)]
public Brutal.Bool8 mDrawVelocity;
///
///
/// Draw the mass and inertia (as the box equivalent) for each body
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:255
///
/// bool mDrawMassAndInertia = false
///
///
[FieldOffset(16)]
public Brutal.Bool8 mDrawMassAndInertia;
///
///
/// Draw stats regarding the sleeping algorithm of each body
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:256
///
/// bool mDrawSleepStats = false
///
///
[FieldOffset(17)]
public Brutal.Bool8 mDrawSleepStats;
///
///
/// Draw the vertices of soft bodies
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:257
///
/// bool mDrawSoftBodyVertices = false
///
///
[FieldOffset(18)]
public Brutal.Bool8 mDrawSoftBodyVertices;
///
///
/// Draw the velocities of the vertices of soft bodies
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:258
///
/// bool mDrawSoftBodyVertexVelocities = false
///
///
[FieldOffset(19)]
public Brutal.Bool8 mDrawSoftBodyVertexVelocities;
///
///
/// Draw the edge constraints of soft bodies
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:259
///
/// bool mDrawSoftBodyEdgeConstraints = false
///
///
[FieldOffset(20)]
public Brutal.Bool8 mDrawSoftBodyEdgeConstraints;
///
///
/// Draw the bend constraints of soft bodies
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:260
///
/// bool mDrawSoftBodyBendConstraints = false
///
///
[FieldOffset(21)]
public Brutal.Bool8 mDrawSoftBodyBendConstraints;
///
///
/// Draw the volume constraints of soft bodies
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:261
///
/// bool mDrawSoftBodyVolumeConstraints = false
///
///
[FieldOffset(22)]
public Brutal.Bool8 mDrawSoftBodyVolumeConstraints;
///
///
/// Draw the skin constraints of soft bodies
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:262
///
/// bool mDrawSoftBodySkinConstraints = false
///
///
[FieldOffset(23)]
public Brutal.Bool8 mDrawSoftBodySkinConstraints;
///
///
/// Draw the LRA constraints of soft bodies
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:263
///
/// bool mDrawSoftBodyLRAConstraints = false
///
///
[FieldOffset(24)]
public Brutal.Bool8 mDrawSoftBodyLRAConstraints;
///
///
/// Draw the rods of soft bodies
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:264
///
/// bool mDrawSoftBodyRods = false
///
///
[FieldOffset(25)]
public Brutal.Bool8 mDrawSoftBodyRods;
///
///
/// Draw the rod states (orientation and angular velocity) of soft bodies
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:265
///
/// bool mDrawSoftBodyRodStates = false
///
///
[FieldOffset(26)]
public Brutal.Bool8 mDrawSoftBodyRodStates;
///
///
/// Draw the rod bend twist constraints of soft bodies
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:266
///
/// bool mDrawSoftBodyRodBendTwistConstraints = false
///
///
[FieldOffset(27)]
public Brutal.Bool8 mDrawSoftBodyRodBendTwistConstraints;
///
///
/// Draw the predicted bounds of soft bodies
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:267
///
/// bool mDrawSoftBodyPredictedBounds = false
///
///
[FieldOffset(28)]
public Brutal.Bool8 mDrawSoftBodyPredictedBounds;
///
///
/// Coloring scheme to use for soft body constraints
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:268
///
/// ESoftBodyConstraintColor mDrawSoftBodyConstraintColor = ESoftBodyConstraintColor::ConstraintType
///
///
[FieldOffset(32)]
public ESoftBodyConstraintColor mDrawSoftBodyConstraintColor;
}
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:55
///
/// void Init(uint inMaxBodies, uint inNumBodyMutexes, const BroadPhaseLayerInterface &inLayerInterface)
///
///
///
///
/// Initialize the manager
///
///
public void Init(uint maxBodies, uint numBodyMutexes, BroadPhaseLayerInterface layerInterface) => Jolt.PInvoke.BodyManager_Init(this, maxBodies, numBodyMutexes, layerInterface);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:58
///
/// uint GetNumBodies() const
///
///
///
///
/// Gets the current amount of bodies that are in the body manager
///
///
public uint GetNumBodies() => Jolt.PInvoke.BodyManager_GetNumBodies(this);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:61
///
/// uint GetMaxBodies() const
///
///
///
///
/// Gets the max bodies that we can support
///
///
public uint GetMaxBodies() => Jolt.PInvoke.BodyManager_GetMaxBodies(this);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:85
///
/// Body * AllocateBody(const BodyCreationSettings &inBodyCreationSettings) const
///
///
///
///
/// Create a body using creation settings. The returned body will not be part of the body manager yet.
///
///
/// The returned handle is borrowed from its owner; don't Dispose it.
///
///
public Body AllocateBody(BodyCreationSettings bodyCreationSettings) => Jolt.PInvoke.BodyManager_AllocateBody(this, bodyCreationSettings);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:88
///
/// Body * AllocateSoftBody(const SoftBodyCreationSettings &inSoftBodyCreationSettings) const
///
///
///
///
/// Create a soft body using creation settings. The returned body will not be part of the body manager yet.
///
///
/// The returned handle is borrowed from its owner; don't Dispose it.
///
///
public Body AllocateSoftBody(SoftBodyCreationSettings softBodyCreationSettings) => Jolt.PInvoke.BodyManager_AllocateSoftBody(this, softBodyCreationSettings);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:91
///
/// void FreeBody(Body *inBody) const
///
///
///
///
/// Free a body that has not been added to the body manager yet (if it has, use DestroyBodies).
///
///
public void FreeBody(Body body) => Jolt.PInvoke.BodyManager_FreeBody(this, body);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:94
///
/// bool AddBody(Body *ioBody)
///
///
///
///
/// Add a body to the body manager, assigning it the next available ID. Returns false if no more IDs are
/// available.
///
///
public bool AddBody(Body body) => Jolt.PInvoke.BodyManager_AddBody(this, body);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:97
///
/// bool AddBodyWithCustomID(Body *ioBody, const BodyID &inBodyID)
///
///
///
///
/// Add a body to the body manager, assigning it a custom ID. Returns false if the ID is not valid.
///
///
public bool AddBodyWithCustomID(Body body, uint bodyID) => Jolt.PInvoke.BodyManager_AddBodyWithCustomID(this, body, bodyID);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:103
///
/// void DestroyBodies(const BodyID *inBodyIDs, int inNumber)
///
///
///
///
/// Remove a set of bodies from the body manager and frees them.
///
///
public unsafe void DestroyBodies(Ptr bodyIDs, int number) => Jolt.PInvoke.BodyManager_DestroyBodies(this, bodyIDs, number);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:107
///
/// void ActivateBodies(const BodyID *inBodyIDs, int inNumber)
///
///
///
///
/// Activate a list of bodies.
/// This function should only be called when an exclusive lock for the bodies are held.
///
///
public unsafe void ActivateBodies(Ptr bodyIDs, int number) => Jolt.PInvoke.BodyManager_ActivateBodies(this, bodyIDs, number);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:111
///
/// void DeactivateBodies(const BodyID *inBodyIDs, int inNumber)
///
///
///
///
/// Deactivate a list of bodies.
/// This function should only be called when an exclusive lock for the bodies are held.
///
///
public unsafe void DeactivateBodies(Ptr bodyIDs, int number) => Jolt.PInvoke.BodyManager_DeactivateBodies(this, bodyIDs, number);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:114
///
/// void SetMotionQuality(Body &ioBody, EMotionQuality inMotionQuality)
///
///
///
///
/// Update the motion quality for a body
///
///
public void SetMotionQuality(Body body, EMotionQuality motionQuality) => Jolt.PInvoke.BodyManager_SetMotionQuality(this, body, motionQuality);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:123
///
/// uint32 GetNumActiveBodies(EBodyType inType) const
///
///
///
///
/// Get the number of active bodies.
///
///
public uint GetNumActiveBodies(EBodyType type) => Jolt.PInvoke.BodyManager_GetNumActiveBodies(this, type);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:126
///
/// uint32 GetNumActiveCCDBodies() const
///
///
///
///
/// Get the number of active bodies that are using continuous collision detection
///
///
public uint GetNumActiveCCDBodies() => Jolt.PInvoke.BodyManager_GetNumActiveCCDBodies(this);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:129
///
/// void SetBodyActivationListener(BodyActivationListener *inListener)
///
///
///
///
/// Listener that is notified whenever a body is activated/deactivated
///
///
public void SetBodyActivationListener(BodyActivationListener listener) => Jolt.PInvoke.BodyManager_SetBodyActivationListener(this, listener);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:130
///
/// BodyActivationListener * GetBodyActivationListener() const
///
///
///
///
/// The returned handle is borrowed from its owner; don't Dispose it.
///
///
public BodyActivationListener GetBodyActivationListener() => Jolt.PInvoke.BodyManager_GetBodyActivationListener(this);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:133
///
/// static inline bool sIsValidBodyPointer(const Body *inBody)
///
///
///
///
/// Check if this is a valid body pointer. When a body is freed the memory that the pointer occupies is
/// reused to store a freelist.
///
///
public static bool sIsValidBodyPointer(Body body) => Jolt.PInvoke.BodyManager_sIsValidBodyPointer(body);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:145
///
/// const Body & GetBody(const BodyID &inID) const
///
///
///
///
/// Access a body (not protected by lock)
///
///
/// The returned handle is borrowed from its owner; don't Dispose it.
///
///
public Body GetBody(uint iD) => Jolt.PInvoke.BodyManager_GetBody(this, iD);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:151
///
/// const Body * TryGetBody(const BodyID &inID) const
///
///
///
///
/// Access a body, will return a nullptr if the body ID is no longer valid (not protected by lock)
///
///
/// The returned handle is borrowed from its owner; don't Dispose it.
///
///
public Body TryGetBody(uint iD) => Jolt.PInvoke.BodyManager_TryGetBody(this, iD);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:195
///
/// void LockAllBodies() const
///
///
///
///
/// Lock all bodies. This should only be done during PhysicsSystem::Update().
///
///
public void LockAllBodies() => Jolt.PInvoke.BodyManager_LockAllBodies(this);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:198
///
/// void UnlockAllBodies() const
///
///
///
///
/// Unlock all bodies. This should only be done during PhysicsSystem::Update().
///
///
public void UnlockAllBodies() => Jolt.PInvoke.BodyManager_UnlockAllBodies(this);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:201
///
/// inline void SetBodyObjectLayerInternal(Body &ioBody, ObjectLayer inLayer) const
///
///
///
///
/// Function to update body's layer (should only be called by the BodyInterface since it also requires
/// updating the broadphase)
///
///
public void SetBodyObjectLayerInternal(Body body, ushort layer) => Jolt.PInvoke.BodyManager_SetBodyObjectLayerInternal(this, body, layer);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:204
///
/// void InvalidateContactCacheForBody(Body &ioBody)
///
///
///
///
/// 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.
///
///
public void InvalidateContactCacheForBody(Body body) => Jolt.PInvoke.BodyManager_InvalidateContactCacheForBody(this, body);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:207
///
/// void ValidateContactCacheForAllBodies()
///
///
///
///
/// Reset the Body::EFlags::InvalidateContactCache flag for all bodies. All contact pairs in the contact
/// cache will now by valid again.
///
///
public void ValidateContactCacheForAllBodies() => Jolt.PInvoke.BodyManager_ValidateContactCacheForAllBodies(this);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:216
///
/// void SaveBodyState(const Body &inBody, StateRecorder &inStream) const
///
///
///
///
/// Save the state of a single body for replay
///
///
public void SaveBodyState(Body body, StateRecorder stream) => Jolt.PInvoke.BodyManager_SaveBodyState(this, body, stream);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:219
///
/// void RestoreBodyState(Body &inBody, StateRecorder &inStream)
///
///
///
///
/// Save the state of a single body for replay
///
///
public void RestoreBodyState(Body body, StateRecorder stream) => Jolt.PInvoke.BodyManager_RestoreBodyState(this, body, stream);
///
///
/// C++:
/// Jolt/Physics/Body/BodyManager.h:272
///
/// void Draw(const DrawSettings &inSettings, const PhysicsSettings &inPhysicsSettings, DebugRenderer *inRenderer, const BodyDrawFilter *inBodyFilter = nullptr)
///
///
///
///
/// Draw the state of the bodies (debugging purposes)
///
///
public void Draw(ref BodyManager.DrawSettings settings, ref PhysicsSettings physicsSettings, DebugRenderer renderer, BodyDrawFilter bodyFilter) => Jolt.PInvoke.BodyManager_Draw(this, ref settings, ref physicsSettings, renderer, bodyFilter);
}
}