Archived

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

Dean Johnson

how to get my ship to fly

Recommended Posts

First let me explain what I am working on. I have a 3d engine that uses frames. Each frame has a position represented by (float x, float y, float z), a velocity represented by (float x, float y, float z), also the yaw, pitch and roll of the frame all represented by floats. The frames do translate down to the other frames. Now my question. How should I set my velocity when I don’t know the amount to add to each of the X, Y, and Z floats? If I have not added and Yaw, Pitch or Roll then just setting the Z velocity works. But how do I calculate the velocity when I change the Yaw Pitch and Roll. Thanks

Share this post


Link to post
Share on other sites
OK, I think it''s this:

x-velocity = velocity * sin(yaw) * cos(pitch)
y-velocity = velocity * sin(pitch)
z-velocity = velocity * cos(yaw) * cos(pitch)

I don''t think the roll affects any of the velocities - only the orientation. No doubt someone will reply and tell me I''m talking cack, but hey, I tried.

Share this post


Link to post
Share on other sites
It''s better to use a vector to represend the rotation (I mean direction) of your ship instead of Euclidean angles (yaw, pitch, roll) like you use now. Once you got it to work with vectors and found the rotate-around-arbitrary-axis matrix, you will feel like God
And after that you can even try quaternions.

Share this post


Link to post
Share on other sites
Just out of interest, are you learning from The Zen of Direct3D Game Programming? I wondered because I read that book and it left out many fundamentals including the one you''re describing.

Share this post


Link to post
Share on other sites
I didn't read any game programming book at all (yet). Most things I tried to figure out myself, or I got help on this forum and flipcode. And there are tutorials on the web of course.

[edited by - Lode on July 31, 2002 3:49:22 PM]

Share this post


Link to post
Share on other sites