rotate or not rotate ...

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Marc
Posts: 25
Joined: Wed Feb 11, 2004 1:03 pm
Contact:

rotate or not rotate ...

Post by Marc »

Hi !

How do I rotate a scenenode? If I do

node = smgr->addAnimatedMeshSceneNode

I can set the position by calling

node->setPosition

but calling

node->setRotation

simply doesn't change anything. All my testfaeries always look in the same direction. By the way, they also do this in all the examples ...

So how can I rotate such a thing?
2D-Splatter-Action => http://www.walkover.de.vu <=
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Should be correct. Maybe the rotation value is too small? Or maybe it helps to call updateAbsolutePosition() afterwards?
Marc
Posts: 25
Joined: Wed Feb 11, 2004 1:03 pm
Contact:

Post by Marc »

ok, the parameters must be in degrees.
2D-Splatter-Action => http://www.walkover.de.vu <=
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

Marc, I need to rotate some scene nodes and my camera, could you be more specific on how you made it?

Code line if possible, plz!!!

:D

cheers!
Image
Marc
Posts: 25
Joined: Wed Feb 11, 2004 1:03 pm
Contact:

Post by Marc »

I use

scenenode->setRotation(core::vector3df(a,b,c));

where the a,b,c are the angles around x,z, and again x axes, if nikos code applies to to standards. For me, I just pluged the angels in the different position until it went right. ;)
The angels have to be in degrees, so from 0-360 instead of from 0-2*PI. If u use the later ones in your internal code, u have to mulitply them by 180/PI.

For some reason this didn't work for me for the camera. There I used

camera->setTarget(core::vector3df(x,z,y));

where (x,y,z) is the point where the camera is looking at. I calculated a point with distance 100 away from the camera position and in the direction where I want to look by again 3 angles.

And there is x,z,y because i don't like the coordinate system of irrlicht. I prefer having the first 2 components the walking plane und the 3rd one the height. But that's just my opinion.
2D-Splatter-Action => http://www.walkover.de.vu <=
exal
Posts: 60
Joined: Tue Feb 24, 2004 9:05 am

Post by exal »

You are not forgetting that you have to add to the rotation every fram otherwise the object will be still at the same rotation all the time?
Marc
Posts: 25
Joined: Wed Feb 11, 2004 1:03 pm
Contact:

Post by Marc »

no, my a,b,c are the absolute rotations coming from my AI-code. Otherwise u have to add rotation instead of just setting it.
2D-Splatter-Action => http://www.walkover.de.vu <=
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

thnx Marc! I'll try it out today.
Image
Post Reply