Hi guys, I was wondering if I could get some help with a rotational math issue. So I’m trying to calculate the number of flips, spins, and rolls my character (a car) does while it is in the air. I had been doing this previously by subtracting my previous Rotator from my current Rotator. This led to gimbal lock when axes went past 180 or pitch went past 90, which resulted in “360 degree roll” output when I did a flip using pitch.
I have since switched to trying to use Quaternions, but since they have 4 values instead of 3, I’m not sure how to map them to flips, yaw, and roll degrees in local space without gimbal lock or weird rotator issues. My goal is to be able to do 3 spins and have an output saying “900 yaw” or 2 flips and have an output of “720 pitch”
So after digging around and learning some additional math, I figured out that I was doing quaternion math wrong and shouldn’t be subtracting but rather multiplying by inverse. The sample below seems to be working pretty reliably for me!