rockets rotate in their direction now.

This commit is contained in:
Andreas Ortmann 2016-09-28 15:33:35 +02:00
parent 3b5b5da02f
commit ff74da1c03

View file

@ -2,8 +2,9 @@
#include <iostream>
#include "glm/gtc/type_ptr.hpp"
#include <glm/gtc/type_ptr.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/euler_angles.hpp>
#include "polygon_model.hpp"
@ -130,8 +131,10 @@ namespace endofthejedi {
glm::mat4 model(1.0f);
static float a = 0.0;
a += 2.0*M_PI * 0.01;
//static float a = 0.0;
//a += 2.0*M_PI * 0.01;
glm::vec2 vn = glm::normalize(missile->velocity);
float a = std::atan2((float) vn.y, (float) vn.x);
model = glm::rotate(model, a, glm::vec3(0.0f, 0.0f, 1.0f));