Object Rotation and Position

Started by
5 comments, last by Plato 20 years, 8 months ago
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
Advertisement
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.
[sub]My spoon is too big.[/sub]
Thank you...
But when I apply those Matrices whole World transforms and rotates?!

How do i apply a matrix to an object??
Plato

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.

Niko Suni

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]
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

Niko Suni

Hum -global world matrix-
Good idea and even logical.
Thanks

This topic is closed to new replies.

Advertisement