#### Archived

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

# Simple question for you gurus!

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

## Recommended Posts

I have an airplane in world space. How to represent its orientation? How to rotate it around its axes? Iam using directx8. I have seen many examples where there is a class representing an 3d object. They also have methods like rotate, but this methods allways apply to world axes! I need it to rotate around its own axes! bye and thanx ivan bolèina

##### Share on other sites
I''ve been watching the questions for a long time, and you are the lucky today.
You must define vectors representing the axis of your object in their class. You also must make functions that converts the rotation on the objects axis onto rotation on the world axis.

##### Share on other sites
Yes, but how?

Since this is used in most games, I hope there is a common well known way of doing this. Any ideas?

bye,ivan

##### Share on other sites

1-Rotate it by it''s rotation values.
2-Rotate it by world-space values.
3-Translate to it''s position in world-space.

To represent all of these..

struct POSROT {
D3DVECTOR pos; // Position, World-Space
D3DVECTOR srot; // Rotation, Self-Space
D3DVECTOR wrot; // Rotation, World-Space
// Simple, but sometimes difficult to use for physics.
}

or

struct OBJPOS {
D3DVECTOR center; // Position, World-Space
D3DVECTOR up; // 1 unit "up" from position
D3DVECTOR fw; // 1 unit "forward" from position
// Use those last two for an "OrientToAxes" function.
}

Using either of those, you can get what you need.

##### Share on other sites
I think you might be a bit confused on the axis. A world transformation always orients an object around it''s own axis in regards to rotation.
Using D3DXMatrixRotationYawPitchRoll is perfect for defining rotational values, which using D3DXMatrixTranslation will work for translation values. Make sure to construct the world transformation matrix in this order: scale * X rotation * Y rotation * Z rotation * translation (or Scale * rotation * translation).

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

• 12
• 12
• 9
• 14
• 10
• ### Forum Statistics

• Total Topics
632655
• Total Posts
3007670
• ### Who's Online (See full list)

There are no registered users currently online

×