Problems building or running the engine, queries about how to use features etc.
-
lonewolff
- Ogre Magi
- Posts: 1207
- Joined: Wed Dec 28, 2005 12:58 am
- x 6
-
Quote
-
0
login to like this post
Post
by lonewolff »
Hi Guys,
I am having some problems with scenenodes.
I have two scenenodes mNode1 and mNode2. They are both attached to the root scenenode.
How do I detach mNode2 to the root and re-attach it to mNode1 (mNode1 being the new parent).
I have tried this but I just get an exception;
Any help would be greatly appreciated
Last edited by
lonewolff on Thu Jul 24, 2014 3:35 am, edited 1 time in total.
-
lonewolff
- Ogre Magi
- Posts: 1207
- Joined: Wed Dec 28, 2005 12:58 am
- x 6
-
Quote
-
0
login to like this post
Post
by lonewolff »
Ok, I have gotten this far
Code: Select all
SceneNode *mNode1=mSceneMgr->getSceneNode(name1);
SceneNode *mNode2=mSceneMgr->getSceneNode(name2);
Node *mNodeParent=mNode2->getParent();
mNodeParent->removeChild(mNode2);
mNode1->addChild(mNode2);
But, things are still not working as anticipated. Time for me to have a big think about what I am doing
-
lonewolff
- Ogre Magi
- Posts: 1207
- Joined: Wed Dec 28, 2005 12:58 am
- x 6
-
Quote
-
0
login to like this post
Post
by lonewolff »
lonewolff wrote:Ok, I have gotten this far
Code: Select all
SceneNode *mNode1=mSceneMgr->getSceneNode(name1);
SceneNode *mNode2=mSceneMgr->getSceneNode(name2);
Node *mNodeParent=mNode2->getParent();
mNodeParent->removeChild(mNode2);
mNode1->addChild(mNode2);
But, things are still not working as anticipated. Time for me to have a big think about what I am doing
[edit]
Yep, the above code works. I just had to pull out the old pen and paper to get my head around what is going on - LOL
Geez I am 'self solving' a lot lately - Hehe