aboutsummaryrefslogtreecommitdiffstats
path: root/src/systems/render.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/systems/render.cpp')
-rw-r--r--src/systems/render.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/systems/render.cpp b/src/systems/render.cpp
index a25b152..f72832b 100644
--- a/src/systems/render.cpp
+++ b/src/systems/render.cpp
@@ -78,7 +78,9 @@ void RenderSystem::render(void)
if (S.first.veltate) {
auto vel = entity.component<Direction>();
- float angle = static_cast<float>(std::atan(vel->y / vel->x)) * 180 / 3.14f;
+ float angle = std::atan(vel->y / vel->x);
+ if (vel->x < 0)
+ angle += 3.14f;
auto toOrigin = glm::translate(glm::mat4(1.0f), glm::vec3(-pos.x, -pos.y, 0.0f));
auto rotation = glm::rotate(glm::mat4(1.0f), angle, glm::vec3(0.0f, 0.0f, 1.0f));
auto toBack = glm::translate(glm::mat4(1.0f), glm::vec3(pos.x, pos.y, 0.0f));