Public Group

#### Archived

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

# how to get my ship to fly

This topic is 5981 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 on other sites
Sorry - had to delete what I posted because I saw lots of flaws in my trig.

[edited by - Bankie on July 31, 2002 2:50:52 PM]

##### 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 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 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 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 on other sites
Bankie ~

U speak Irish - Conas atá tú?
U speak scotland irish and its different but still.

##### Share on other sites
Ciamar a tha thu, Cuchulainn? Na, I don''t really speak any flavour of Gaelic - Just plain old ugly Glasgwegian.

1. 1
2. 2
Rutin
22
3. 3
4. 4
5. 5
khawk
14

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633743
• Total Posts
3013643
×