How can i change a node's coordinates!

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
mmh771
Posts: 39
Joined: Thu Apr 27, 2006 7:02 am

How can i change a node's coordinates!

Post by mmh771 »

I have an ICameraSceneNode* camera in my scene, i used camera->setPosition(vector3df(100, 30, 200)) to set it above a terrain.

Now i need to reset the Camera coordinates to be (0, 0, 0) without moving back to 0, 0, 0! ....

I hope you got what i am trying to say here ...

And now when i move the camera again, lets say to 10, 30, 50, i want its coordinates to be 0, 0, 0 after moving to that position!

Any idea how to reset a node coordinates!... no matter where it moves, i want its coordinates to move with it.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Well, I think this is not possible...
But you could use 2 empty scene nodes for this...
  • 1. set the cam to the new position
    2. set a empty node to the same position
    3. make the cam a chhild of the empty node
    4. set cam position to 0,0,0
Then annother cam move:
  • 1. set the cam to the new position
    2. set the other empty node to the same position (with cam->getAbsolutePosition() )
    3. make the cam a child of the empty node and remove it from the first
    4. set cam position to 0,0,0
and so on... ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Presumably you just want to update the cameras location by a vector, like 10, 30, 50 as you said, but adding that vector on to the current positon, instead of setting it to that actual position in the world.

All you have to do is camera->setPosition(camera->getPosition() + vector3d(10,30,50))

I would have thought...
Image Image Image
needforhint
Posts: 322
Joined: Tue Aug 30, 2005 10:34 am
Location: slovakia

Post by needforhint »

if you want your camera coords allways 0,0,0, doeas it mean you attach something to that camera? becouse if you make a child node, the node will be relative to the camera parent, thus camera have (0,0,0) coords for everything that is its child.... and childs can freely move in the space of their parents
what is this thing...
Post Reply