- Home /
Question by
saberboy117 · Apr 06, 2011 at 10:39 PM ·
rotationeulerangles
Fighter Plane Rotating Issues
Im making a simple Fighter Plane but am having issues controlling it. The Plane rotates on all 3 axis. when level it rotates fine but when it is facing straight upward the y turning is the same as the z.
Code:
// v,h and rot are user inputs
function getTurning(v,h,rot){
var turn : Vector3;
t.rotation.x += (v*TurnSpeed/50);
t.rotation.y += (h*TurnSpeed/50);
t.rotation.z += (rot*TurnSpeed/50);
}
How do I make it so that it rotates the plane like the rotate tool, on its own axis?
Thanks.
Comment
Best Answer
Answer by Statement · Apr 06, 2011 at 10:46 PM
It sounds like you ran into a bit of gimbal lock.
Try something like this, using Rotate, instead:
function getTurning(var v : float, var h : float, var rot : float) {
var ts = TurnSpeed / 50.0f;
t.Rotate(v * ts, h * ts, rot * ts);
}
Your answer