I have a rigidbody and use 4 keys to addtorque in 4 different directions:
- W adds torque positively along the X axis (pitch forward)
- S adds torque negatively along the X axis (pitch backward)
- A adds torque negatively along the Y axis (yaw left)
- D adds torque postively along the Y axis (yaw right)
The rigidbody is able to rotate around/spin in any combination of these directions, but my issue is how can I count the number of rotations it has done in any given axis? Eg. if the player has completed 2 360 rotations to their left I would like to display "2 Left Spins" etc.
I have tried storing the eulerangles of each axis but this is no good as it resets after certain degrees.
I think the way it could work is on keydown reset a degrees counter, while the key is being held I could continue to store the change in rotation for that axis, and then on keyup I could divide this total number of degrees by 360. I'm not sure how to do this in C# though, or if this is the best way to do this.
How could I do this?