From f47dd669f12795c9fd13ace9ce8324c50bb4dbe5 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Mon, 7 Jun 2021 11:37:16 +0200 Subject: [PATCH] Collisions are still broke --- lib/wal/sources/Wal.hpp | 2 +- sources/Map/Map.cpp | 2 +- sources/Runner/Runner.cpp | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/wal/sources/Wal.hpp b/lib/wal/sources/Wal.hpp index 85a7804e..de6bb394 100644 --- a/lib/wal/sources/Wal.hpp +++ b/lib/wal/sources/Wal.hpp @@ -84,7 +84,7 @@ namespace WAL //! @brief True if the engine should close after the end of the current tick. bool shouldClose = false; //! @brief The time between each fixed update. - static constexpr std::chrono::nanoseconds timestep = std::chrono::milliseconds(16); + static constexpr std::chrono::nanoseconds timestep = std::chrono::milliseconds(32); //! @brief Create a new system in place. //! @return The wal instance used to call this function is returned. This allow method chaining. diff --git a/sources/Map/Map.cpp b/sources/Map/Map.cpp index 722f0433..c6b237ff 100644 --- a/sources/Map/Map.cpp +++ b/sources/Map/Map.cpp @@ -19,7 +19,7 @@ namespace BBM auto &pos = entity.getComponent(); const auto &wallPos = wall.getComponent(); auto diff = pos.position + mov->getVelocity() - wallPos.position; - std::cout << diff << std::endl; +// mov->_velocity = Vector3f(); if (diff.x <= 0 && mov->_velocity.x < 0) mov->_velocity.x = 0; if (diff.x >= 0 && mov->_velocity.x > 0) diff --git a/sources/Runner/Runner.cpp b/sources/Runner/Runner.cpp index bfcddef7..16c2a1a7 100644 --- a/sources/Runner/Runner.cpp +++ b/sources/Runner/Runner.cpp @@ -72,6 +72,12 @@ namespace BBM scene->addEntity("camera") .addComponent(8, 20, 7) .addComponent(Vector3f(8, 0, 8)); +// scene->addEntity("cube") +// .addComponent(5, 0, 5) +// .addComponent(Vector3f(-5, 0, -5), Vector3f(3, 3, 3), RED) +// .addComponent() +// .addComponent() +// .addComponent(WAL::Callback(), &MapGenerator::wallCollide, 3); std::srand(std::time(nullptr)); MapGenerator::loadMap(16, 16, MapGenerator::createMap(16, 16), scene); return scene;