What's the standard/accepted way of associating an object(say a ship) with a scene node? My node selection by mouse is working now, but I'm not sure how to go from node to object.
Do I create a ShipSceneNode with doesn't change SceneNode, just connect it with my ship-object?
Associate object with node
One way you could do it is by creating an std::map<ISceneNode*,ShipObject*>. If you haven't used a map before, here is what they are: http://www.cplusplus.com/reference/stl/map/ If you need an example I would be happy to write one.
Also, Irrlicht has it's own implementation of the map collection (I don't know how it is different from std::map or which is better) which is documented here: http://irrlicht.sourceforge.net/docu/cl ... _1map.html
I think they both work the same way from the front end. You could also do what you said and make a custom scene node that has a pointer to the ship object, which would be faster if your game is going to be CPU intensive.
Also, Irrlicht has it's own implementation of the map collection (I don't know how it is different from std::map or which is better) which is documented here: http://irrlicht.sourceforge.net/docu/cl ... _1map.html
I think they both work the same way from the front end. You could also do what you said and make a custom scene node that has a pointer to the ship object, which would be faster if your game is going to be CPU intensive.
we use a base class 'CObject' which houses a scenenode. we then set the ID of the scenenode, the ID of the object and the ID of the physicsobject to the same value. When 'picking' an object, we can use either the normal smgr selection style (which returns us a scenenode) or we can use the physics engine picking method (which returns us a physicsobject). either way, since they all have the same ID, we can easily search the master list of objects to find the right one. In the editor, we allow the user to toggle between 'scenenode' and 'physicsobject' selection.
the object class should have more info than just the scenenode. Using a custom scenenode might work, but you still need to attach the AI, physics, etc... it is easier to create a custom object class that houses all of this and then use the ID's to keep them in sync. It also makes it easier to maintain seperate lists for object updating, dead objects etc...