setParent or addChild

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
Zar
Posts: 29
Joined: Mon Aug 07, 2006 4:46 pm
Location: Brazil

setParent or addChild

Post by Zar »

I would like to know if there is any difference/advantage between attaching a scene node to a camera using node->setParent(camera); or camera->addChild(node), besides the order of declarations?

I'm testing both with the same results.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

They have the same effect. setParent() can be used to set the parent to NULL if you want to remove a node from the scene graph temporarily. It calls addChild() if the parent you specified is a valid pointer, so setParent() is a tiny bit more expensive.
Zar
Posts: 29
Joined: Mon Aug 07, 2006 4:46 pm
Location: Brazil

Post by Zar »

vitek wrote:They have the same effect. setParent() can be used to set the parent to NULL if you want to remove a node from the scene graph temporarily. It calls addChild() if the parent you specified is a valid pointer, so setParent() is a tiny bit more expensive.
@vitek

Thanks a lot!
Post Reply