Object Stats

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
Richard_Smith159
Posts: 1
Joined: Mon May 04, 2015 6:30 am

Object Stats

Post by Richard_Smith159 »

Hi all,
Recently downloaded Irrlicht and I absolutely love it.

The tutorials and forum are really helpful but I have a question I could use some help with.

The game I'm making is an RTS, so I need to get object data when I click on the mesh. How would I get things like the remaining hit points of a building by clicking on the mesh representing it?

For example (in case I haven't explained myself well :P ):

Say I have a class called Building_A. This class has a property called health and a mesh called Building_A_Mesh. How would I get the current value of health if I were to click on the mesh in game?

Thanks in advance!
Best regards,
Rich
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Object Stats

Post by hendu »

The irrlicht functions will give you the scenenode you clicked on. In your data you might have a mapping from that to the building.

std::map<ISceneNode *, mybuilding *> nodeToBuilding;
Post Reply