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


world space

Recommended Posts

Hi all, If I have an object, say a cube for example defined in object space, how do I define world space - do I need to have x,y,z offsets within the cube object and use the world transformation matrix to put it into world space - I just can''t seem to get it into my head how you position objects in a ''big world''. Any help on this subject would be much appreciated. Thanks, Steve

Share this post

Link to post
Share on other sites
If you have a cube defined in object space (sometimes called local space) then you need to apply a world transform to this cube to get it into world space. (The cube''s object space will be, typically, with respect to it''s own local origin).

To transform the cube into world space you will need to build the relevant transform - which typically comprises of translations, rotations and scaling operations. So, your cube would have a variable somewhere in it''s definition that indicates it''s position in world space. From this value you can determine the translation portion of the overall world transformation. It is also likely that your cube will have a rotation about the x,y and z axes. These values can be used to create your local->world portion of the overall world transformation for your cube. Likewise with scaling.

I know I haven''t explained this too clearly... let''s try something else...

xPos = 10
yPos = 20
zPos = 30

xRot = 0
yRot = 1
zRot = 0

Here the cube has a position (10,20,30) - which is it''s position in WORLD space. So you would call a function along the lines of...

(and likewise with rotation)

Cube->SetRotation(rotMatrix,Cube.xRot.... etc.

These matrices (transMatrix and rotMatrix) can be concatenated to create your overall transformation matrix. This resulting matrix is your cube''s world matrix and will place the cube in world space.


I was never too good at explaining things - hope it helps a little!


Share this post

Link to post
Share on other sites
Thanks Sharky, you have explained that perfectly - I thought
the object did need to have world x,y and z positions and you
have now convinced it does!


Share this post

Link to post
Share on other sites