0

I am trying to make a game in space with Newtonian physics. I am trying to make an object (spaceship) increase its rotation speed when WASD keys are pressed. I used a vec3 to represent rotation speed for each axis. My problem is, how to calculate the rotation speed in respect to the coordinate system when I only know the speed I want in relation to my object (spaceship)?

In other words, my player is looking through the object. I want to go rotate left relative to him when he presses A, but I don't know how to calculate it in relation to the universe (coordinate system).

Peter Harmann
  • 230
  • 3
  • 9
  • 2
    that depends on the matrices and notation you use ... use [object local coordinate system transforms](https://stackoverflow.com/a/28084380/2521214) and [Newton d'Lambert physics](https://stackoverflow.com/a/19764828/2521214) they work for angles ([`alpha,omega,epsilon`](https://stackoverflow.com/a/27857371/2521214)) too in the same manner as for position (`pos,vel,acc`) also this [Figure out what keys a player is pressing based on relative velocity and angle](https://stackoverflow.com/a/37772514/2521214) might help a bit. – Spektre May 19 '18 at 06:42
  • 1
    Also, don't use Euler angles to represent rotation speed. There is no reasonable way to get a reasonable rotation update from this representation (you can't just add the speed to the rotation). – Nico Schertler May 20 '18 at 05:48

0 Answers0