// Copyright (C) 2015 Jérôme Leclercq // This file is part of the "Nazara Development Kit" // For conditions of distribution and use, see copyright notice in Prerequesites.hpp #include #include #include #include #include namespace Ndk { PhysicsSystem::PhysicsSystem() { Requires(); } PhysicsSystem::PhysicsSystem(const PhysicsSystem& system) : System(system), m_world() { } void PhysicsSystem::Update(float elapsedTime) { m_world.Step(elapsedTime); for (const Ndk::EntityHandle& entity : GetEntities()) { NodeComponent& node = entity->GetComponent(); PhysicsComponent& phys = entity->GetComponent(); NzPhysObject& physObj = phys.GetPhysObject(); node.SetRotation(physObj.GetRotation(), nzCoordSys_Global); node.SetPosition(physObj.GetPosition(), nzCoordSys_Global); } } SystemIndex PhysicsSystem::systemIndex; }