Commit 1eb71421 authored by Elias Broschin's avatar Elias Broschin
Browse files

fix cannon rotation

parent ec978088
......@@ -167,7 +167,7 @@ namespace gdw {
//CANNON ROTATION
auto world_pos = engine_.game_play_system().game_input_manager().get_world_mouse_pos();
auto v1 = glm::normalize(world_pos - cannon->position());
auto v1 = glm::normalize(world_pos);
auto v2 = cannon->rotation() * glm::vec3(0,0,1);
auto angle = std::acos(glm::dot(v1,v2)/ (glm::length(v1) * glm::length(v2)));
......@@ -176,9 +176,9 @@ namespace gdw {
auto axis = glm::normalize(cross);
auto s = sin(angle/2.f);
auto x = axis.x *s;
auto y = axis.y *s;
auto z = axis.z *s;
auto x = axis.x * s;
auto y = axis.y * s;
auto z = axis.z * s;
auto w = cos(angle/2.f);
cannon->rotation(glm::quat(w,x,y,z));
......
Subproject commit 3d4dbe849e8db70238497c1546f390aea8cf51bb
Subproject commit ad9ab973a17ebbf0471883a5d25d9f295c56af59
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment