rockets rotate in their direction now.
This commit is contained in:
parent
3b5b5da02f
commit
ff74da1c03
1 changed files with 6 additions and 3 deletions
|
@ -2,8 +2,9 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "glm/gtc/type_ptr.hpp"
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
|
#include <glm/gtx/euler_angles.hpp>
|
||||||
|
|
||||||
#include "polygon_model.hpp"
|
#include "polygon_model.hpp"
|
||||||
|
|
||||||
|
@ -130,8 +131,10 @@ namespace endofthejedi {
|
||||||
|
|
||||||
glm::mat4 model(1.0f);
|
glm::mat4 model(1.0f);
|
||||||
|
|
||||||
static float a = 0.0;
|
//static float a = 0.0;
|
||||||
a += 2.0*M_PI * 0.01;
|
//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));
|
model = glm::rotate(model, a, glm::vec3(0.0f, 0.0f, 1.0f));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue