Jump to content
  • Advertisement
Sign in to follow this  

Transform world, or main object?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, My friend and I are starting on a simple flight simulator for enjoyment as well as learning. I've gone through some Direct X tutorials, and I have some basic movement implemented (still having some math errors, but thats beside the point). My main question is: When moving around the world, should the main object - the plane in this case - be what moves while the world is stationary, or should the main object be stationary, and the world is moved around the object. The way its currently implemented is according to some Direct X tutorials, in which the world moves around the stationary object. I didn't know if there was a general rule of thumb, or a common practice in this case. It would seem to me that it would be easier to move the single object, but Direct X already has the Transform.World function which can greatly simplify things. Any input for either case would be appreciated. Thanks! [Edited by - cghill on September 29, 2006 4:38:03 PM]

Share this post

Link to post
Share on other sites
Niether. You don't actually get a choice; it's just a convention of interpretation on your part.


Direct X already has the Transform.World function

Transform.World is not a function. It's a matrix. And it does not transform the world; it transforms thing into the world's coordinate system (i.e., into the world).

When you submit a collection of vertices to be rendered (by any API), those vertices are assumed to be what is known as "model space," the coordinate space in which the model is conviently defined. For example, a cube is usually built in a model space where the origin (0,0,0) is the center of the cube. Humanoid characters may be built in a model space where the origin is at their feet.

A matrix transformation is applied to those model space points to bring them into world space, the coordinate system where (0,0,0) is the origin of the world and all objects are arranged relatively in it. In additional to specifying the location and orientation of all objects in the world (include both your plane and all the scenary objects that make up the actual visible landscape), you specify the location and orientation of the camera; the point from which you will ultimatley be viewing the rendered scene.

The location and orientation of the camera allows you to define a matrix transformation that brings the objects in world space into view space, a space where (0,0,0) is the location of the eye and the direction you are looking along is a specific axis (usually Z).

After this, a projection matrix transformation is applied to bring the geometry into what is known as clip space, and from there we move to normalized device coordinate space and finally window space, where rasterization ultimately occurs. These last two spaces are not really that relevant right now.

The first transformation is known as the "world transform," and that is what Transform.World is. It doesn't move the world, it positions and orients an object within the world.

The second transform is known as the "view transform."
The third transform is known as the "projection transform."

You can elect whether or not to interpret the viewing transformation as "rotating the world" or "rotating the view," but it is purely an interpretation. You don't really elect to "move the world around your plane" or "move the plane in the world" unless the plane also happens to be the point at which your camera is (in which case, why draw the plane?).

If you can, I would suggest picking up these books:
Fundamentals of Computer Graphics
The Geometry Toolbox

They do an excellent job of explaining what is going on here. Much better than any tutorial will.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!