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
IrrEdit: How to access single objects like meshes etc.
-
FlyingIsFun1217
- Posts: 219
- Joined: Fri Apr 13, 2007 8:29 pm
- Location: Illinois
- Contact:
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:
I hope my post was helpful ;]
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;
}
}