What really happens when node is rotated??

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
thatdudeoverthere
Posts: 28
Joined: Fri Apr 24, 2009 2:43 pm
Location: over there...

What really happens when node is rotated??

Post by thatdudeoverthere »

My question is when you tell a scene node to rotate on an axis(y for example) what really happens is that Irrlicht is taking the mesh's vertices and rotating them around the axis to simulate the effect of a rotation on its axis based on a quaternion. is this correct?? I'm just asking to better understand how irrlicht works and to stasify my curosity and if not then can someone explain what's happening. Thanks in advance!
//Personal code

bool sarcasm;

void set_sarcastic()
{
sarcasm = true;
}
[img]
http://imgs.xkcd.com/comics/goto.png
[/img]
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

For the most part, Irrlicht doesn't move vertices at all. There are a few functions that do, but those are part of the IMeshManipulator interface.

Every scene node has an affine transformation matrix, called the world matrix, that defines the relative position, rotation and scale of the vertex data relative to some other point in 3d space. These matrices can be multiplied together to accumulate position, rotation and scale. This allows objects defined by multiple vertices to move relative to some other moving object (imagine the moon orbiting around the earth, which orbits around the sun).

Changing the position, rotation or scale of a scene node just updates one of these matrices. The matrix is later passed along to the video driver (Direct3D, OpenGL, ...) which uses the world matrix (along with the view and projection matrices) to transform the vertex data into screen space.

Irrlicht doesn't use quaternions for rotations internally. It could definitely do it, but the video drivers all expect matrices, so Irrlicht would need to convert quaternions into matrices all the time.

Travis
thatdudeoverthere
Posts: 28
Joined: Fri Apr 24, 2009 2:43 pm
Location: over there...

Post by thatdudeoverthere »

Ok so the video drivers are the ones doing the rotations based on matrices and irrlicht just passes the vertices data along.. Thanks Vitek!! that cleared some things up
//Personal code

bool sarcasm;

void set_sarcastic()
{
sarcasm = true;
}
[img]
http://imgs.xkcd.com/comics/goto.png
[/img]
Post Reply