0

I'm not used to use quaternions, it is the first time I'm working with them. Since there aren't examples about using them I've hit a brick wall.

I'm trying to shoot a ball in the mouse direction. If the mouse is closer to the player the shot will have height, if the mouse is further away the shot is low.

Right now I have this: http://pastebin.com/tgZAU8qV

I've no idea how I can pass a "Z angle" to my quaternion in such way that the shot will be high instead of low. Any ideas how I can achieve this behaviour?

Thanks

Ben
  • 2,314
  • 1
  • 19
  • 36
André Costa
  • 117
  • 1
  • 15
  • Why would you want to rotate around the z axis, wouldn't you just translate it in y/-y direction ? – Thomas Apr 17 '16 at 21:15
  • That's right it's Y direction. – André Costa Apr 19 '16 at 15:45
  • But why would you want a rotation? Basicly a quaternion is just a rotation (w) around a specified vector (x,y,z). So if you plan to see the player as the center, looking in the -z direction you just need to adjust the y coordnitate when working with the starting position – Thomas Apr 20 '16 at 14:08

0 Answers0