Ok, that is basically what I have at the moment, it must not be working because I'm not in Euler and I that's what the math was for. Can't use mAbs though, as that will result in the cube, for example, starting at 0, rotating 1440, then rotating -720 and ending up at 2160 degrees.
Basically, my current math is as follows. %startRotationX was passed in as the current rotation when the loop started:
LOOP START
%totalAngleX = %totalAngleX + getWord(%cube.getTransform(), 3) - %startRotationX;
%startRotX = getWord(%cube.getTransform(), 3);
WAIT 50 MS & LOOP TO BEGINNING
Would this then work with Euler angles? I think it should, going through a couple simulated steps:
Starts at 10 degrees.
Total = 0 + 10 - 10; (nothing has changed since loop just began)
StartRot = 10; (Since this was taken immediately afterwards, hasn't changed)
LOOP. Rotated 20 degrees since then. Now reads 30.
Total = 0 + 30 - 10; (total now = 20)
StarRot = 30;
LOOP. Rotated -50 this time (rotation to 340). Here's where I'm running into trouble. It should read -10, but it doesn't.
Total = 20 + 340 - 30;
StartRot = 340;
Final rotation: 330 degrees when it should be -30. Easily converted at the moment, but with more loop iterations, it gets further and further from being able to do that post calculation.
I guess what I need them is to convert 0 through 360 to -360 through 0, but only when spinning in the opposite direction. Is this even possible? And will that even work?