Archived

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

Object Rotation and Position

This topic is 5244 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. I''m trying to rotate and set position of an object in my 3d world. After creating to simple triangles within vertexbuffer and setting up world, view and translation matrices, I want one triangle to move and rotate. How can I realise this? Thank you Plato

Share this post


Link to post
Share on other sites
The purpose of the world matrix is to transform your object from model space to world space. Changing the matrix changes the orientation of the object. So, to move an object, apply a translation matrix to the world. To rotate it, apply a rotation matrix.

I like pie.

Share this post


Link to post
Share on other sites

1: Set the transform for the object you want to draw.
2: Draw it.
3: goto 1 while DrawableObjectsLeft

The transforms only affect the things you draw after setting them.

Share this post


Link to post
Share on other sites
Alright thank you!

Im doing like this now:

-Reading currentWorldTransformation into tmp
-Tranlate and Rotate my Object into p_objMatrix
-SetWorldTransform(p_objMatrix)
-Draw Object
-SetWorldTransform(tmp)

Is this correct?

[edited by - Plato on August 8, 2003 6:23:07 AM]

Share this post


Link to post
Share on other sites
Somewhat, yes.
However, you shouldn''t have to ''read'' the temp matrix from everywhere (video card).

Instead, you should already have the global world transformation established when starting rendering.

Read up on ''matrix stacks'', i dont remember any links though...

Nik

Share this post


Link to post
Share on other sites