Game Development Community

how to determine if an object already is in "gClientSceneGraph"

by Stefan Beffy Moises · in Torque Game Engine · 07/30/2002 (10:57 am) · 3 replies

Hi there!
Is there a way to determine if an object was already added to the scenegraph before adding it with
gClientSceneGraph->addObjectToScene(shape);
Or should I just not care at all, cause in the end,
SceneGraph::zoneInsert(SceneObject* obj) is called for my ShapeBase object, and this function *seems* to check that anyways... but I'm not 100 percent sure about that...
any insights?
Thanks! :)

#1
07/31/2002 (1:33 pm)
Stefan,

All SceneObjects maintain a reference to their scene manager called 'mSceneManager'. If this is NULL then it's not in one else it will point to the appropriate one.

The only problem you may have with this is that it's protected so you'll need to inherit unfortunately. Of course you could add a function in SceneObject to check for NULL against this member for you, ;)

Hope this helps,

- Melv
#2
07/31/2002 (1:46 pm)
Melv, it does, it does! :D
Thanks a lot, I'll put that function in :-)
#3
07/31/2002 (3:23 pm)
Or as you said insertZone checks for this anyway.