Get scene node by id?

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
danielmccarthy
Posts: 51
Joined: Fri May 30, 2014 12:55 am

Get scene node by id?

Post by danielmccarthy »

How can I get a scene node by id?

Many thanks,
Dan
kklouzal
Posts: 343
Joined: Sun Mar 28, 2010 8:14 pm
Location: USA - Arizona

Re: Get scene node by id?

Post by kklouzal »

I'm pretty sure Irrlicht doesn't have functionality like this built in, you're going to have to write your own EntityManger or NodeManager class or something like that.
Dream Big Or Go Home.
Help Me Help You.
danielmccarthy
Posts: 51
Joined: Fri May 30, 2014 12:55 am

Re: Get scene node by id?

Post by danielmccarthy »

Damn the engine is missing a lot of cool stuff. Never mind will have to go down that route then.
Thanks
kklouzal
Posts: 343
Joined: Sun Mar 28, 2010 8:14 pm
Location: USA - Arizona

Re: Get scene node by id?

Post by kklouzal »

You need to remember this is a Graphics Library not a Game Engine. Those kind of implementations are better left to the actual game engine to do with it as they see fit. Irrlicht is very transparent in this respect, which is a good thing.
Dream Big Or Go Home.
Help Me Help You.
danielmccarthy
Posts: 51
Joined: Fri May 30, 2014 12:55 am

Re: Get scene node by id?

Post by danielmccarthy »

At the moment for my game I use an Object class which holds a scene node. I needed a way to identify objects from each other so I set the first 16 bits of the ID for the node as the actual id and the higher bits to the object type.

Then when I am identifying the nodes I can tell what object type they are and their id so it could be a floor item type, a in game object type ect ect

Is this a hacky way of going about things?
kklouzal
Posts: 343
Joined: Sun Mar 28, 2010 8:14 pm
Location: USA - Arizona

Re: Get scene node by id?

Post by kklouzal »

It depends on how you are/plan grabbing the objects out of your scene in the first place.
Dream Big Or Go Home.
Help Me Help You.
danielmccarthy
Posts: 51
Joined: Fri May 30, 2014 12:55 am

Re: Get scene node by id?

Post by danielmccarthy »

In the event handler I check to see if a node has been clicked if it has I call a function in my game class which then calls a function which returns an OBJECT struct specifying the type of object it is and its position and id ect ect. From their the game can set certain gamestats which will then be read in the client class ready to send off to the server
JLouisB
Posts: 67
Joined: Tue Jul 24, 2012 12:36 pm
Location: France

Re: Get scene node by id?

Post by JLouisB »

Use this :
http://irrlicht.sourceforge.net/docu/cl ... 6c55d52b55


edit : I see that getSceneNodeFromType can also get all the nodes with the specified type by passing a core::array< scene::ISceneNode * > to the function.
It can be logical and useful to have the same system for getSceneNodeFromId and getSceneNodeFromName.
In particular because the ID are designed to be a collision mask for the collisions functions, so in the case the ID are not designed to be unique but they can be designed to indicate the type of the object, so this feature can be useful, at least for getSceneNodeFromId (maybe it can added to Irrlicht ?).
Last edited by JLouisB on Fri Aug 22, 2014 3:28 pm, edited 2 times in total.
luthyr
Posts: 69
Joined: Wed Dec 30, 2009 5:47 pm

Re: Get scene node by id?

Post by luthyr »

I generally used getSceneNodeFromId(), but that tended to be slow, so I keep my own map of ID'd scenenodes for look up.
Post Reply