Rotating a node...
Posted: Sat Jan 24, 2004 12:57 pm
Hi.
I am trying to rotate a scene node upon user input (A or D keys)
I already have forward and backwards movement as follows...
switch(event.KeyInput.Key)
{
case KEY_KEY_W:
case KEY_KEY_S:
{
core::vector3df v = node1->getPosition();
v.X += event.KeyInput.Key == KEY_KEY_W ? 4.0f : -4.0f;
node1->setPosition(v);
}
return true;
What I want to do is a similar thing with rotation with A and D. I thought that this might work...
case KEY_KEY_A:
case KEY_KEY_D:
{
core::vector3df r = node1->getRotation();
r.rotateXZBy(event.KeyInput.Key == KEY_KEY_A ? 4.0f : -4.0f, r);
}
return true;
}
but it doesn't. The Docs for Irrlicht say rotateXZBy() takes 2 parameters. The first is 64bit float for the degree of rotation. The second is vector3df. Could someone please reply with what 45 degs and 90 degs looks like in 64bit float form, and also what the second parameter (the vector3df) refers to.
Many thanks...
Eric the half a bee
I am trying to rotate a scene node upon user input (A or D keys)
I already have forward and backwards movement as follows...
switch(event.KeyInput.Key)
{
case KEY_KEY_W:
case KEY_KEY_S:
{
core::vector3df v = node1->getPosition();
v.X += event.KeyInput.Key == KEY_KEY_W ? 4.0f : -4.0f;
node1->setPosition(v);
}
return true;
What I want to do is a similar thing with rotation with A and D. I thought that this might work...
case KEY_KEY_A:
case KEY_KEY_D:
{
core::vector3df r = node1->getRotation();
r.rotateXZBy(event.KeyInput.Key == KEY_KEY_A ? 4.0f : -4.0f, r);
}
return true;
}
but it doesn't. The Docs for Irrlicht say rotateXZBy() takes 2 parameters. The first is 64bit float for the degree of rotation. The second is vector3df. Could someone please reply with what 45 degs and 90 degs looks like in 64bit float form, and also what the second parameter (the vector3df) refers to.
Many thanks...
Eric the half a bee