3D spacesim math problem

Started by
3 comments, last by BamBam 21 years, 9 months ago
Hi i have some problems with my 3D spacesim game (DX8) I use 2 angeles to define the players direction One on XZ plane and one in YP plane where P is the point where the XZ angele crosses a sphere with the radius 1 Erm sounds complicatet, yet? Ok then now this I use a third angele to define the players spaceships rotaition around its own longitudinal axis My YAW,PITCH and ROLL variables get positive or negative by pressing a key Now its this: Ryz = Ryz + (YAW * Sin(Rla)) + (PITCH * Cos(Rla)) Rxz = Rxz + (YAW * Cos(Rla)) + (PITCH * Sin(Rla)) Rla = Rla + ROLL Ok but yawing the ship when Ryz is <>0 would effect all three axis of the ship Hmm get the point?? I really hope you can help me out with that or maybe tell me a bether way to get my keyboard and mouse input to 3D angeles and with no gimbal lock problem in "real" 3D (space) Thanxx in advance!!!!! Chris
Advertisement
People here are going to parrot the "use quaternions" mantra, and that may actually be the best solution for you. Check the articles and see if quaternions fit what you need to do.
But how do i get my keyboard input to the quaternion angeles ??
Use keyboard input to produce euler angles which you then convert to a quaternion. Then you simply conjugate that quaternion with the one you''re maintaining. The trick is the order of operations.
I''m sorry but this looks just not that kind of simple to me!

Can you please post some code? I think i understand what you mean but I don''t know how to code this !?

This topic is closed to new replies.

Advertisement