Game Development Community

Getting access to console object from inside the engine

by Soeren Vesti · in Torque Game Engine · 01/30/2007 (3:01 am) · 3 replies

Hi I am in need some data that is present in a declared console object
from another class. How do I access console objects from inside the engine?
Is there some list that I could look up in if I have the name of the class?

regards

#1
01/30/2007 (3:35 am)
Sim::findObject(const char* name)
will return the object, i think. You'll still have to cast it though.
#2
01/30/2007 (5:04 am)
Ok thank you
#3
01/31/2007 (8:14 pm)
Example:
SimObject *tObj = Sim::findObject(objId);
   SimSet* nObj = dynamic_cast<SimSet*>(tObj);
   if(nObj)
      mCellList = nObj;
   else
   {
      Con::printf("Dynamic cast failed.");
   }

Dynamic cast will fail if object is not inherited from SimSet in this example. The SimSet can be replaced with any class. This lets you discriminate between objects.