diff --git a/SDK/src/NDK/Systems/PhysicsSystem2D.cpp b/SDK/src/NDK/Systems/PhysicsSystem2D.cpp index 29baeb6a1..6579bb1fb 100644 --- a/SDK/src/NDK/Systems/PhysicsSystem2D.cpp +++ b/SDK/src/NDK/Systems/PhysicsSystem2D.cpp @@ -161,6 +161,17 @@ namespace Ndk m_dynamicObjects.Remove(entity); m_staticObjects.Insert(entity); + // If entities just got added to the system, teleport them to their NodeComponent position/rotation + // This will prevent the physics engine to mess with the scene while correcting position/rotation + if (justAdded) + { + auto& collision = entity->GetComponent(); + auto& node = entity->GetComponent(); + + Nz::RigidBody2D* physObj = collision.GetStaticBody(); + physObj->SetPosition(Nz::Vector2f(node.GetPosition())); + //physObj->SetRotation(node.GetRotation()); + } } if (!m_physWorld)