I wrote a class for NPC, that contains a pointer to the node.
When I shoot on NPCs, a simple getSceneNodeFromRayBB() returns a pointer to the
node that was hit. Is there a way to get a pointer to the class instead, to
be able to call its die() method?
you'll need to store some reference to the NPC object into the node...
for example Newton objects have a void* to store datas you need, but Irrlicht doesn't provide such...
so I can think of some workarounds:
1st - add a void* to the ISceneNode class...
2nd - if you don't need the node's ID you can use it to store an index or maybe the pointer to the NPC object...
Acki wrote:you'll need to store some reference to the NPC object into the node...
for example Newton objects have a void* to store datas you need, but Irrlicht doesn't provide such...
so I can think of some workarounds:
1st - add a void* to the ISceneNode class...
2nd - if you don't need the node's ID you can use it to store an index or maybe the pointer to the NPC object...