- Home /
Calculate an object's rotation, etc.
I'm making a car stunt game. I'm more of a modeller than a programmer, however. Therefore I am missing a key script which I am unable to write. Basically, I need to write a script that calculates the rotation around the three main directions. And for it to display a GUI based on it (I might be able to do this part.) So, I need a script which works out degrees rotated (y rotation), 'rollspins' (z rotation) and 'flips' (x rotation.) Just tracking those variables is enough, I'll work out the rest from there.
Answer by _MGB_ · Mar 30, 2011 at 08:11 PM
An object's Transform.eulerAngles will give you the current orientation that you want. You'd have to do something like store the last orientation and compare to work out deltas for your requirements I think. Remember to handle angle wraparound.