Archived

This topic is now archived and is closed to further replies.

g

orientation of a spaceship

Recommended Posts

g    135
I''m writing a space game in which you have free control of a fighter like craft in three dimensions - think X-wing, Tie Fighter, Wing Commander, Freespace, Elite, X-Comm Interceptor, to name but a few. Anyhow, the problem is deciding how best to represent the orientation of a ship in 3D. The game will have multiplayer support, so it is important that orientations can be easily extrapolated from old orientations and angular velocities. Possibilities may include: - storing some kind of heading, pitch and roll in radians; but this might be quite awkward to work with, and I''m not sure how the extrapolation might work. - storing a normalised ''forwards'' vector; but this doesn''t contain any information on the ''roll'' of the ship; I could use another value or vector to hold this information, but I''m not sure how best to do it. - matrices? - quaternians? (I don''t know anything about them) So that''s basically it - especially if you have any experience of doing this before, I would like you hear your recommendations.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
I''ve been doing something similar, I use a normalised forward vector and a normal to it, that covers all your angles, so to speak

Share this post


Link to post
Share on other sites
Lars W.    122
Hi
I am storing direction, normal and side. I translate them by the rotation values (roll, pitch and yaw) every frame and also keep my transform matrix and their inverse updated.
If i need synchronisation i can rebuild the transform matrix from the direction, normal and side.

But i still have a problem:
My spaceship has a current orientation (oDir,oNorm,oSide). Now i want it to point to a new target orientation (tDir,tNorm,tSide). For that i need to specify the roll (rotation around z), pitch(around x) and yaw(around y) values. Normally i do this with my joystick without problems, but i want my AI doing the same. So how do i get the rotational values from two orientations ?

Thanks
Lars

[edited by - Lars W. on October 4, 2002 6:50:34 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
I would use either a matrix or quaterions. To move you ship, multiply the current matrix by a rotation around the X,Y,or Z axis of the current matrix (ie the 1st,2nd,or 2rd row of that matrix if row-major).

Share this post


Link to post
Share on other sites
Xero-X2    184
I really recommend quaternions I made a little mini space flyer in about 30 mins with them (opengl,thrust,brake,mouse control for look, full freedom of rotation includeing roll)

you can learn about quaternions here on gamedev.net under articles & resources->Math and Physics->Quaternions

( http://www.gamedev.net/reference/list.asp?categoryid=28#150 )

[edited by - Xero-X2 on October 4, 2002 5:22:27 PM]

Share this post


Link to post
Share on other sites
crossbow    122
Since we''re on the topic of quaternions, I was wondering exactly what SLERP is? What uses does it have, for instance? And what does the interpolation in the acronym SLERP mean anyways? Just wondering.

Thanks!

Share this post


Link to post
Share on other sites