Game Development Community

Getting a dynamic field from an object in c++

by Hedd Roberts · in Torque Game Engine · 11/03/2010 (3:44 pm) · 0 replies

I know this should never be done, but can anyone tell me why this doesnt work!

const char *fieldName = StringTable->insert( "madeOf" , false);
const char *expStr = rInfo.object->getDataField( fieldName, NULL); // get the dynamic field value

SimObject * expSim = Sim::findObject(expStr); // find the object/datablock with that string name
ExplosionData * explosion = static_cast< ExplosionData* >( expSim ); // convert to explosion data

I`m no expert but this should work right? Or am I missing something?

Thanks! Any help is appreciated!