#include #include #include #include #include #include SCENARIO("PhysicsSystem2D", "[NDK][PHYSICSSYSTEM2D]") { GIVEN("A world and an entity") { Ndk::World world; const Ndk::EntityHandle& entity = world.CreateEntity(); Ndk::NodeComponent& nodeComponent = entity->AddComponent(); Nz::Vector2f position(2.f, 3.f); nodeComponent.SetPosition(position); Nz::Rectf aabb(0.f, 0.f, 16.f, 18.f); Nz::BoxCollider2DRef collisionBox = Nz::BoxCollider2D::New(aabb); Ndk::CollisionComponent2D& collisionComponent = entity->AddComponent(collisionBox); Ndk::PhysicsComponent2D& physicsComponent = entity->AddComponent(); WHEN("We update the world") { world.Update(1.f); THEN("Entity should have correct bounding box") { REQUIRE(nodeComponent.GetPosition() == position); aabb.Translate(position); REQUIRE(physicsComponent.GetAABB() == aabb); } } } }