-
3D Math translations
Hi, I am really stuck on 3D math, and I am making a flight sim game in OpenGL, and I realized I don't know how to code the movement of the plane. For instance: when i turn the plane upwards how would I calculate the path it would travel on? I know rotation on the y axis, but a can't figure it out on the x axis(the problem above). I would appreciate any help, this is making my head hurt :-). Thanks!
-
i'm not sure exactly what your asking... maybe try this it explains matrices, matrix rotations, translations, ect...
http://www.geocities.com/SiliconVall.../matrices.html
-
I can help you out here...you are going to need to be able to rotate on all three axises for a good flight sim. I wouldn't normally do this, but hey, you're in need, I won't make you find it yourself, I'll tell you what you need to do. I'm going to use X, Y, and Z for everything, but the part to the left of = is the new coordinate, where you will display something, and on the right is the original coordinates, except where it is associated with the trig function, that's the angle rotated over that axis...on with it!
x=x(cos y * cos z)+y(cos y * sin z) + z(-sin y);
y=x((sin x * sin y * cos z)-(cos x * sin z)) + y((sin x * sin y * sin z) + z(sin x * cos y);
z=x((cos x * sin y * cos z) + (sin x * sin z)) + y((cos x * sin y * sin z) - (sin x * cos z)) + z(cos x * cos y);
hope that helps...it doesn't do translations, but you should be able to code those easily enough...