IrrEdit: How to access single objects like meshes etc.

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
Daerst
Posts: 12
Joined: Tue May 01, 2007 2:31 pm
Location: Braunschweig, Germany
Contact:

IrrEdit: How to access single objects like meshes etc.

Post by Daerst »

Hi there,

so, I wanna use .irr-files to add my scenes in a game, but I didn't find the answer for this kinda basic question: how to access single objects in the whole scene? So if I have a terrain with a house and a dwarf, how can I for example make the dwarf move or rotate or whatever?

Thank you,
Daerst
FlyingIsFun1217
Posts: 219
Joined: Fri Apr 13, 2007 8:29 pm
Location: Illinois
Contact:

Post by FlyingIsFun1217 »

Use a pointer.

FlyingIsFun1217 :)
Daerst
Posts: 12
Joined: Tue May 01, 2007 2:31 pm
Location: Braunschweig, Germany
Contact:

Post by Daerst »

Sorry, I don't quite get that... Pointing to what? O_O Could you give an example or a link where it's explained?
Kurak
Posts: 7
Joined: Sat Feb 17, 2007 7:26 pm
Location: Poland
Contact:

Post by Kurak »

You mean in game?

You can get RootSceneNode children list and iterate through it getting pointers to scene nodes you want.

1. Get RootSceneNode children list (smgr->getRootSceneNode()->getChilden() afair)
2. iterate through it (for)
3. for each node you can check type of node (by calling getType method) and name (getName) and some other things but I use only these 2 in my game to qualify each scene node as gameplay object (as power-up or sth)

For example, you want to get all mesh scene nodes from scene:

Code: Select all

core::list<IMeshSceneNode*> meshList;
for(core::list<ISceneNode*>::Iterator itor = smgr->getRootSceneNode().getChildren().begin(); itor != smgr->getRootSceneNode().getChildren().end(); ++itor)
{
  if((*itor)->getType() == ESNT_MESH)
  {
    meshList.push_back((IMeshSceneNode*)(*itor));
    cout << "Hey guys I found funny node with name " << (*itor)->getName() << endl;
  }
}
I hope my post was helpful ;]
Daerst
Posts: 12
Joined: Tue May 01, 2007 2:31 pm
Location: Braunschweig, Germany
Contact:

Post by Daerst »

Exactly what I needed :wink:
Kurak wrote:I hope my post was helpful ;]
It definitely was, thank you :)
Post Reply