Game Development Community

Finding an objects in c++ based on its name?

by Neil Marshall · in Torque Game Engine · 09/07/2003 (12:19 pm) · 3 replies

My function is in C++ and I have the name of the object (Trigger5) and I want to get it's properties (It's position mainly). How do I do that?

#1
09/07/2003 (3:37 pm)
Sim::findObject() is your friend.
#2
09/08/2003 (1:45 pm)
Um, findObject want's 2 variables. The name of the object (Which I have) and the type of object. How do I say "Any type of object in the world"?

void GuiCheckpointArrow::setLookAtObject( const char* objectName )
{
   ?????? objectType = NULL;
   mCheckpointName = objectName;
   if ( Sim::findObject(objectName,objectType) == false ) {
      Con::printf(":::::: %s not found", objectName);
   } else {
      Con::printf(":::::: %s FOUND!", objectName);
   }
}
#3
09/08/2003 (5:52 pm)
You would want to specify a SimObject, a SceneObject, or so forth. Torque's inheritance hierarchy is there for a reason.