diff --git a/src/Nazara/JoltPhysics3D/JoltPhysics3D.cpp b/src/Nazara/JoltPhysics3D/JoltPhysics3D.cpp index e22b4a6ca..9b56516a2 100644 --- a/src/Nazara/JoltPhysics3D/JoltPhysics3D.cpp +++ b/src/Nazara/JoltPhysics3D/JoltPhysics3D.cpp @@ -13,7 +13,6 @@ #include #include #include -#include #include // Callback for traces, connect this to your own trace function if you have one @@ -27,7 +26,7 @@ static void TraceImpl(const char* inFMT, ...) va_end(list); // Print to the TTY - std::cout << buffer << std::endl; + NazaraError(buffer); } namespace Nz diff --git a/src/Nazara/JoltPhysics3D/Systems/JoltPhysics3DSystem.cpp b/src/Nazara/JoltPhysics3D/Systems/JoltPhysics3DSystem.cpp index 4e406a27c..ee8e0141e 100644 --- a/src/Nazara/JoltPhysics3D/Systems/JoltPhysics3DSystem.cpp +++ b/src/Nazara/JoltPhysics3D/Systems/JoltPhysics3DSystem.cpp @@ -20,8 +20,6 @@ namespace Nz m_bodyDestructConnection = registry.on_destroy().connect<&JoltPhysics3DSystem::OnBodyDestruct>(this); m_stepCount = 0; - m_physicsTime = Time::Zero(); - m_updateTime = Time::Zero(); } JoltPhysics3DSystem::~JoltPhysics3DSystem() @@ -39,23 +37,6 @@ namespace Nz rigidBodyComponent.Destroy(true); } - void JoltPhysics3DSystem::Dump() - { - if (m_stepCount == 0) - m_stepCount = 1; - -/* - NazaraDebug("Physics time: " << (m_physicsTime / Time::Nanoseconds(m_stepCount))); - NazaraDebug("Replication time: " << (m_updateTime / Time::Nanoseconds(m_stepCount))); - NazaraDebug("Active entity count: " << m_physWorld.GetActiveBodyCount())); - NazaraDebug("--"); -*/ - - m_stepCount = 0; - m_physicsTime = Time::Zero(); - m_updateTime = Time::Zero(); - } - bool JoltPhysics3DSystem::RaycastQuery(const Vector3f& from, const Vector3f& to, const FunctionRef(const RaycastHit& hitInfo)>& callback) { return m_physWorld.RaycastQuery(from, to, [&](const JoltPhysWorld3D::RaycastHit& hitInfo) @@ -66,8 +47,8 @@ namespace Nz if (extendedHitInfo.hitBody) { std::size_t bodyIndex = extendedHitInfo.hitBody->GetBodyIndex(); - if (bodyIndex < m_physicsEntities.size()) - extendedHitInfo.hitEntity = entt::handle(m_registry, m_physicsEntities[bodyIndex]); + if (bodyIndex < m_bodyIndicesToEntity.size()) + extendedHitInfo.hitEntity = entt::handle(m_registry, m_bodyIndicesToEntity[bodyIndex]); } return callback(extendedHitInfo); @@ -84,8 +65,8 @@ namespace Nz if (extendedHitInfo.hitBody) { std::size_t bodyIndex = extendedHitInfo.hitBody->GetBodyIndex(); - if (bodyIndex < m_physicsEntities.size()) - extendedHitInfo.hitEntity = entt::handle(m_registry, m_physicsEntities[bodyIndex]); + if (bodyIndex < m_bodyIndicesToEntity.size()) + extendedHitInfo.hitEntity = entt::handle(m_registry, m_bodyIndicesToEntity[bodyIndex]); } callback(extendedHitInfo); @@ -164,11 +145,11 @@ namespace Nz JoltRigidBody3DComponent& rigidBody = registry.get(entity); rigidBody.Construct(m_physWorld); - std::size_t uniqueIndex = rigidBody.GetBodyIndex(); - if (uniqueIndex >= m_physicsEntities.size()) - m_physicsEntities.resize(uniqueIndex + 1); + UInt32 uniqueIndex = rigidBody.GetBodyIndex(); + if (uniqueIndex >= m_bodyIndicesToEntity.size()) + m_bodyIndicesToEntity.resize(uniqueIndex + 1); - m_physicsEntities[uniqueIndex] = entity; + m_bodyIndicesToEntity[uniqueIndex] = entity; } void JoltPhysics3DSystem::OnCharacterConstruct(entt::registry& registry, entt::entity entity) @@ -181,9 +162,9 @@ namespace Nz { // Unregister owning entity JoltRigidBody3DComponent& rigidBody = registry.get(entity); - std::size_t uniqueIndex = rigidBody.GetBodyIndex(); - assert(uniqueIndex <= m_physicsEntities.size()); + UInt32 uniqueIndex = rigidBody.GetBodyIndex(); + assert(uniqueIndex <= m_bodyIndicesToEntity.size()); - m_physicsEntities[uniqueIndex] = entt::null; + m_bodyIndicesToEntity[uniqueIndex] = entt::null; } }