How to set nodes' origin?

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
laci37
Posts: 6
Joined: Mon Jan 19, 2009 7:12 pm

How to set nodes' origin?

Post by laci37 »

How can I set a node's origin? I mean the point wich it rotates around. I'd like to use it for a TPS camera, the camera parented to the character and both rotated by the mouse.
DtD
Posts: 264
Joined: Mon Aug 11, 2008 7:05 am
Location: Kansas
Contact:

Post by DtD »

You can either create an empty scene node (See this) then make the scene node a child of the character and the camera a child of the empty scene node. THen rotate the empty scene node.

Or you can use some trig to figure out where the camera would be.

~DtD
laci37
Posts: 6
Joined: Mon Jan 19, 2009 7:12 pm

It worked

Post by laci37 »

It worked nicely, one thing to note is you have to update the camera's target if you rotate it .

EDIT: Well after a bit testing i found that I will have to use some complicated maths to calculate the rotation on the vertical plane do you know anything to bypass this? I'm not in the mood to write geometrical maths...
laci37
Posts: 6
Joined: Mon Jan 19, 2009 7:12 pm

I can't work it out

Post by laci37 »

I can't work out how to calculate the rotation on the vertical plane. Can't anybody give me some help??? The problem is that this vertival plane I have to rotate te camera on is changed by the rotation on the vertical axis.
I got this thing with my medicore maths knowledge:

rotX/rotZ=tan(rotY)

I dont event know if it's good or not because I cant calculate it.
zillion42
Posts: 324
Joined: Wed Aug 29, 2007 12:32 am
Location: Hamburg, Germany

Post by zillion42 »

try rogerborgs quaternion rotation sample, works for me...

http://irrlicht.sourceforge.net/phpBB2/ ... n+rotation
Post Reply