diff --git a/SDK/include/NDK/Components/PhysicsComponent2D.hpp b/SDK/include/NDK/Components/PhysicsComponent2D.hpp index 3983c26a5..c12084116 100644 --- a/SDK/include/NDK/Components/PhysicsComponent2D.hpp +++ b/SDK/include/NDK/Components/PhysicsComponent2D.hpp @@ -99,6 +99,8 @@ namespace Ndk void OnComponentDetached(BaseComponent& component) override; void OnDetached() override; void OnEntityDestruction() override; + void OnEntityDisabled() override; + void OnEntityEnabled() override; struct PendingPhysObjectStates { diff --git a/SDK/src/NDK/Components/PhysicsComponent2D.cpp b/SDK/src/NDK/Components/PhysicsComponent2D.cpp index 3ad5616e6..e5b42e183 100644 --- a/SDK/src/NDK/Components/PhysicsComponent2D.cpp +++ b/SDK/src/NDK/Components/PhysicsComponent2D.cpp @@ -117,5 +117,19 @@ namespace Ndk m_object.reset(); } + void PhysicsComponent2D::OnEntityDisabled() + { + NazaraAssert(m_object, "Invalid physics object"); + + m_object->EnableSimulation(false); + } + + void PhysicsComponent2D::OnEntityEnabled() + { + NazaraAssert(m_object, "Invalid physics object"); + + m_object->EnableSimulation(true); + } + ComponentIndex PhysicsComponent2D::componentIndex; }