// // Generated by Brutal.Jolt.Generate; do not edit by hand. #nullable enable using Brutal.Interop; using Brutal.Numerics; namespace Brutal.JoltApi { public static partial class Jolt { public static unsafe partial class PInvoke { /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:35 ///
/// PhysicsSystem() ///
///
/// /// /// Constructor / Destructor /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_Create")] public static partial PhysicsSystem PhysicsSystem_Create(); [LibraryImport("jolt", EntryPoint = "PhysicsSystem_Destroy")] public static partial void PhysicsSystem_Destroy(PhysicsSystem self); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:59 ///
/// void Init(uint inMaxBodies, uint inNumBodyMutexes, uint inMaxBodyPairs, uint inMaxContactConstraints, const BroadPhaseLayerInterface &inBroadPhaseLayerInterface, const ObjectVsBroadPhaseLayerFilter &inObjectVsBroadPhaseLayerFilter, const ObjectLayerPairFilter &inObjectLayerPairFilter) ///
///
/// /// /// Initialize the system. /// @param inMaxBodies Maximum number of bodies to support. /// @param inNumBodyMutexes Number of body mutexes to use. Should be a power of 2 in the range [1, 64], use 0 to auto detect. /// @param inMaxBodyPairs Maximum amount of body pairs to process (anything else will fall through the world), this number should generally be much higher than the max amount of contact points as there will be lots of bodies close that are not actually touching. /// @param inMaxContactConstraints Maximum amount of contact constraints to process (anything else will fall through the world). /// @param inBroadPhaseLayerInterface Information on the mapping of object layers to broad phase layers. Since this is a virtual interface, the instance needs to stay alive during the lifetime of the PhysicsSystem. /// @param inObjectVsBroadPhaseLayerFilter Filter callback function that is used to determine if an object layer collides with a broad phase layer. Since this is a virtual interface, the instance needs to stay alive during the lifetime of the PhysicsSystem. /// @param inObjectLayerPairFilter Filter callback function that is used to determine if two object layers collide. Since this is a virtual interface, the instance needs to stay alive during the lifetime of the PhysicsSystem. /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_Init")] public static partial void PhysicsSystem_Init(PhysicsSystem self, uint maxBodies, uint numBodyMutexes, uint maxBodyPairs, uint maxContactConstraints, BroadPhaseLayerInterface broadPhaseLayerInterface, ObjectVsBroadPhaseLayerFilter objectVsBroadPhaseLayerFilter, ObjectLayerPairFilter objectLayerPairFilter); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:62 ///
/// void SetBodyActivationListener(BodyActivationListener *inListener) ///
///
/// /// /// Listener that is notified whenever a body is activated/deactivated /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_SetBodyActivationListener")] public static partial void PhysicsSystem_SetBodyActivationListener(PhysicsSystem self, BodyActivationListener listener); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:63 ///
/// BodyActivationListener * GetBodyActivationListener() const ///
///
/// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_GetBodyActivationListener")] public static partial BodyActivationListener PhysicsSystem_GetBodyActivationListener(PhysicsSystem self); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:67 ///
/// void SetContactListener(ContactListener *inListener) ///
///
/// /// /// Listener that is notified whenever a contact point between two bodies is added/updated/removed. /// You can't change contact listener during PhysicsSystem::Update but it can be changed at any other time. /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_SetContactListener")] public static partial void PhysicsSystem_SetContactListener(PhysicsSystem self, ContactListener listener); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:68 ///
/// ContactListener * GetContactListener() const ///
///
/// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_GetContactListener")] public static partial ContactListener PhysicsSystem_GetContactListener(PhysicsSystem self); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:71 ///
/// void SetSoftBodyContactListener(SoftBodyContactListener *inListener) ///
///
/// /// /// Listener that is notified whenever a contact point between a soft body and another body /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_SetSoftBodyContactListener")] public static partial void PhysicsSystem_SetSoftBodyContactListener(PhysicsSystem self, SoftBodyContactListener listener); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:72 ///
/// SoftBodyContactListener * GetSoftBodyContactListener() const ///
///
/// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_GetSoftBodyContactListener")] public static partial SoftBodyContactListener PhysicsSystem_GetSoftBodyContactListener(PhysicsSystem self); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:89 ///
/// void SetSimShapeFilter(const SimShapeFilter *inShapeFilter) ///
///
/// /// /// Set/get the shape filter that will be used during simulation. This can be used to exclude shapes within a body from colliding with each other. /// E.g. if you have a high detail and a low detail collision model, you can attach them to the same body in a StaticCompoundShape and use the ShapeFilter /// to exclude the high detail collision model when simulating and exclude the low detail collision model when casting rays. Note that in this case /// you would need to pass the inverse of inShapeFilter to the CastRay function. Pass a nullptr to disable the shape filter. /// The PhysicsSystem does not own the ShapeFilter, make sure it stays alive during the lifetime of the PhysicsSystem. /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_SetSimShapeFilter")] public static partial void PhysicsSystem_SetSimShapeFilter(PhysicsSystem self, SimShapeFilter shapeFilter); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:90 ///
/// const SimShapeFilter * GetSimShapeFilter() const ///
///
/// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_GetSimShapeFilter")] public static partial SimShapeFilter PhysicsSystem_GetSimShapeFilter(PhysicsSystem self); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:111 ///
/// void SetPhysicsSettings(const PhysicsSettings &inSettings) ///
///
/// /// /// Control the main constants of the physics simulation /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_SetPhysicsSettings")] public static partial void PhysicsSystem_SetPhysicsSettings(PhysicsSystem self, ref PhysicsSettings settings); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:115 ///
/// const BodyInterface & GetBodyInterface() const ///
///
/// /// /// Access to the body interface. This interface allows to to create / remove bodies and to change their /// properties. /// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_GetBodyInterface")] public static partial BodyInterface PhysicsSystem_GetBodyInterface(PhysicsSystem self); /// /// /// Version that does not lock the bodies, use with great care! /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:117 ///
/// const BodyInterface & GetBodyInterfaceNoLock() const ///
///
/// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_GetBodyInterfaceNoLock")] public static partial BodyInterface PhysicsSystem_GetBodyInterfaceNoLock(PhysicsSystem self); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:121 ///
/// const BroadPhaseQuery & GetBroadPhaseQuery() const ///
///
/// /// /// Access to the broadphase interface that allows coarse collision queries /// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_GetBroadPhaseQuery")] public static partial BroadPhaseQuery PhysicsSystem_GetBroadPhaseQuery(PhysicsSystem self); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:124 ///
/// const NarrowPhaseQuery & GetNarrowPhaseQuery() const ///
///
/// /// /// Interface that allows fine collision queries against first the broad phase and then the narrow /// phase. /// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_GetNarrowPhaseQuery")] public static partial NarrowPhaseQuery PhysicsSystem_GetNarrowPhaseQuery(PhysicsSystem self); /// /// /// Version that does not lock the bodies, use with great care! /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:125 ///
/// const NarrowPhaseQuery & GetNarrowPhaseQueryNoLock() const ///
///
/// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_GetNarrowPhaseQueryNoLock")] public static partial NarrowPhaseQuery PhysicsSystem_GetNarrowPhaseQueryNoLock(PhysicsSystem self); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:128 ///
/// void AddConstraint(Constraint *inConstraint) ///
///
/// /// /// Add constraint to the world /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_AddConstraint")] public static partial void PhysicsSystem_AddConstraint(PhysicsSystem self, Constraint constraint); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:131 ///
/// void RemoveConstraint(Constraint *inConstraint) ///
///
/// /// /// Remove constraint from the world /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_RemoveConstraint")] public static partial void PhysicsSystem_RemoveConstraint(PhysicsSystem self, Constraint constraint); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:148 ///
/// void OptimizeBroadPhase() ///
///
/// /// /// Optimize the broadphase, needed only if you've added many bodies prior to calling Update() for the first time. /// Don't call this every frame as PhysicsSystem::Update spreads out the same work over multiple frames. /// If you add many bodies through BodyInterface::AddBodiesPrepare/AddBodiesFinalize and if the bodies in a batch are /// in a roughly unoccupied space (e.g. a new level section) then a call to OptimizeBroadPhase is also not needed /// as batch adding creates an efficient bounding volume hierarchy. /// Don't call this function while bodies are being modified from another thread or use the locking BodyInterface to modify bodies. /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_OptimizeBroadPhase")] public static partial void PhysicsSystem_OptimizeBroadPhase(PhysicsSystem self); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:151 ///
/// void AddStepListener(PhysicsStepListener *inListener) ///
///
/// /// /// Adds a new step listener /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_AddStepListener")] public static partial void PhysicsSystem_AddStepListener(PhysicsSystem self, PhysicsStepListener listener); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:154 ///
/// void RemoveStepListener(PhysicsStepListener *inListener) ///
///
/// /// /// Removes a step listener /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_RemoveStepListener")] public static partial void PhysicsSystem_RemoveStepListener(PhysicsSystem self, PhysicsStepListener listener); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:162 ///
/// EPhysicsUpdateError Update(float inDeltaTime, int inCollisionSteps, TempAllocator *inTempAllocator, JobSystem *inJobSystem) ///
///
/// /// /// Simulate the system. /// The world steps for a total of inDeltaTime seconds. This is divided in inCollisionSteps iterations. /// Each iteration consists of collision detection followed by an integration step. /// This function internally spawns jobs using inJobSystem and waits for them to complete, so no jobs will be running when this function returns. /// The temp allocator is used, for example, to store the list of bodies that are in contact, how they form islands together /// and data to solve the contacts between bodies. At the end of the Update call, all allocated memory will have been freed. /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_Update")] public static partial EPhysicsUpdateError PhysicsSystem_Update(PhysicsSystem self, float deltaTime, int collisionSteps, TempAllocator tempAllocator, JobSystem jobSystem); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:171 ///
/// void SaveBodyState(const Body &inBody, StateRecorder &inStream) const ///
///
/// /// /// Saving state of a single body. /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_SaveBodyState")] public static partial void PhysicsSystem_SaveBodyState(PhysicsSystem self, Body body, StateRecorder stream); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:174 ///
/// void RestoreBodyState(Body &ioBody, StateRecorder &inStream) ///
///
/// /// /// Restoring state of a single body. /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_RestoreBodyState")] public static partial void PhysicsSystem_RestoreBodyState(PhysicsSystem self, Body body, StateRecorder stream); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:181 ///
/// void DrawBodies(const BodyManager::DrawSettings &inSettings, DebugRenderer *inRenderer, const BodyDrawFilter *inBodyFilter = nullptr) ///
///
/// /// /// Draw the state of the bodies (debugging purposes) /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_DrawBodies")] public static partial void PhysicsSystem_DrawBodies(PhysicsSystem self, ref BodyManager.DrawSettings settings, DebugRenderer renderer, BodyDrawFilter bodyFilter); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:184 ///
/// void DrawConstraints(DebugRenderer *inRenderer) ///
///
/// /// /// Draw the constraints only (debugging purposes) /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_DrawConstraints")] public static partial void PhysicsSystem_DrawConstraints(PhysicsSystem self, DebugRenderer renderer); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:187 ///
/// void DrawConstraintLimits(DebugRenderer *inRenderer) ///
///
/// /// /// Draw the constraint limits only (debugging purposes) /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_DrawConstraintLimits")] public static partial void PhysicsSystem_DrawConstraintLimits(PhysicsSystem self, DebugRenderer renderer); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:190 ///
/// void DrawConstraintReferenceFrame(DebugRenderer *inRenderer) ///
///
/// /// /// Draw the constraint reference frames only (debugging purposes) /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_DrawConstraintReferenceFrame")] public static partial void PhysicsSystem_DrawConstraintReferenceFrame(PhysicsSystem self, DebugRenderer renderer); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:194 ///
/// void SetGravity(Vec3Arg inGravity) ///
///
/// /// /// Set gravity value /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_SetGravity")] public static partial void PhysicsSystem_SetGravity(PhysicsSystem self, float3 gravity); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:195 ///
/// Vec3 GetGravity() const ///
///
[LibraryImport("jolt", EntryPoint = "PhysicsSystem_GetGravity")] public static partial float3 PhysicsSystem_GetGravity(PhysicsSystem self); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:198 ///
/// inline const BodyLockInterfaceNoLock & GetBodyLockInterfaceNoLock() const ///
///
/// /// /// Returns a locking interface that won't actually lock the body. Use with great care! /// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_GetBodyLockInterfaceNoLock")] public static partial BodyLockInterfaceNoLock PhysicsSystem_GetBodyLockInterfaceNoLock(PhysicsSystem self); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:201 ///
/// inline const BodyLockInterfaceLocking & GetBodyLockInterface() const ///
///
/// /// /// Returns a locking interface that locks the body so other threads cannot modify it. /// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_GetBodyLockInterface")] public static partial BodyLockInterfaceLocking PhysicsSystem_GetBodyLockInterface(PhysicsSystem self); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:204 ///
/// const ObjectVsBroadPhaseLayerFilter &GetObjectVsBroadPhaseLayerFilter() const ///
///
/// /// /// Broadphase layer filter that decides if two objects can collide, this was passed to the Init /// function. /// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_GetObjectVsBroadPhaseLayerFilter")] public static partial ObjectVsBroadPhaseLayerFilter PhysicsSystem_GetObjectVsBroadPhaseLayerFilter(PhysicsSystem self); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:207 ///
/// const ObjectLayerPairFilter &GetObjectLayerPairFilter() const ///
///
/// /// /// Object layer filter that decides if two objects can collide, this was passed to the Init function. /// /// /// The returned handle is borrowed from its owner; don't Dispose it. /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_GetObjectLayerPairFilter")] public static partial ObjectLayerPairFilter PhysicsSystem_GetObjectLayerPairFilter(PhysicsSystem self); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:216 ///
/// uint GetNumBodies() const ///
///
/// /// /// Gets the current amount of bodies that are in the body manager /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_GetNumBodies")] public static partial uint PhysicsSystem_GetNumBodies(PhysicsSystem self); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:219 ///
/// uint32 GetNumActiveBodies(EBodyType inType) const ///
///
/// /// /// Gets the current amount of active bodies that are in the body manager /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_GetNumActiveBodies")] public static partial uint PhysicsSystem_GetNumActiveBodies(PhysicsSystem self, EBodyType type); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:222 ///
/// uint GetMaxBodies() const ///
///
/// /// /// Get the maximum amount of bodies that this physics system supports /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_GetMaxBodies")] public static partial uint PhysicsSystem_GetMaxBodies(PhysicsSystem self); /// /// /// C++: /// Jolt/Physics/PhysicsSystem.h:248 ///
/// bool WereBodiesInContact(const BodyID &inBody1ID, const BodyID &inBody2ID) const ///
///
/// /// /// Check if 2 bodies were in contact during the last simulation step. Since contacts are only detected between active bodies, so at least one of the bodies must be active in order for this function to work. /// It queries the state at the time of the last PhysicsSystem::Update and will return true if the bodies were in contact, even if one of the bodies was moved / removed afterwards. /// This function can be called from any thread when the PhysicsSystem::Update is not running. During PhysicsSystem::Update this function is only valid during contact callbacks: /// - During the ContactListener::OnContactAdded callback this function can be used to determine if a different contact pair between the bodies was active in the previous simulation step (function returns true) or if this is the first step that the bodies are touching (function returns false). /// - During the ContactListener::OnContactRemoved callback this function can be used to determine if this is the last contact pair between the bodies (function returns false) or if there are other contacts still present (function returns true). /// /// [LibraryImport("jolt", EntryPoint = "PhysicsSystem_WereBodiesInContact")] public static partial Brutal.Bool8 PhysicsSystem_WereBodiesInContact(PhysicsSystem self, uint body1ID, uint body2ID); } } }