#include #include #include #include #include SCENARIO("VelocitySystem", "[NDK][VELOCITYSYSTEM]") { GIVEN("A world and an entity with velocity & node components") { Ndk::World world; const Ndk::EntityHandle& entity = world.CreateEntity(); Ndk::VelocityComponent& velocityComponent = entity->AddComponent(); Ndk::NodeComponent& nodeComponent = entity->AddComponent(); WHEN("We give a speed to our entity") { Nz::Vector3f velocity = Nz::Vector3f::Unit() * 2.f; velocityComponent.linearVelocity = velocity; world.Update(1.f); THEN("Our entity should have moved") { REQUIRE(nodeComponent.GetPosition().SquaredDistance(velocity) < 0.2f); } } } }