I need to rotate a 3d object around its own axes after it has snapped to a screen container, but I don't find the mathematics to do it with tilt, heading and roll. Please help!
Basically what I want is: Imagine you're sitting infront of a turntable with an object rotating on it. To see this effect, all three rotation parameters tilt, heading and roll must be animated accordingly, but I can't figure out the maths to calculate these values. Something like this...
function turntableRotation (degreesToRotate){ var tilt = model.rotate.tilt; var heading = model.rotate.heading; var roll = model.rotate.roll;
************************************************************************************** * "Magic formula" that takes degreesToRotate, tilt, heading and roll as input * * and gives newtilt, newheading and newroll as output * ************************************************************************************** model.rotate.tilt = newtilt; model.rotate.heading = newheading; model.rotate.roll = newroll;
A DF