Game Development Community

Mask Type Hierarchy

by Infinitum3D · in Torque Game Engine · 03/31/2009 (2:18 pm) · 9 replies

I don't know if I'm wording this right (texting while driving - shame shame)...

ShapeBaseTypeObject is a derivative of StaticTypeObject right? InteriorTypeObject is also, am I right? When I say a derivative I mean its "more specific" correct?

Is there a flow chart for this somewhere?

I'm trying to find a list of all types. I'm usimg a rayCast to search for a specific mask type. If I use something like $MaskType:StaticTypeObject Then I get trees, rocks, interiors, etc. But if I use ShapeBaseTypeObject then I don't get interiors, just trees, rocks... That's good, I'm getting more specific. I also don't want TerrainTypeObjects or VehicleTypeObjects or ForceFieldTypeObjects... I found all these types mentioned in various script files.

Where is the master list?

Thanks!

Tony

#1
03/31/2009 (7:36 pm)
Another way to do it would be like this:

%ray = ContainerRayCast(%start,%end,$TypeMasks::InteriorObjectType | $TypeMasks::ShapeBaseObjectType | $TypeMasks::TerrainObjectType);

By separating each typemask with a "|", you can specify more than one. The example I gave will find the first object from %start to %end that is an interior, terrain, or ShapeBase object.

Hope that helps!
#2
04/01/2009 (4:42 am)
Bryce,

Thanks! That does help a lot, but I still need a list of all the different mask types. I'm gessing they are defined in the source somewhere, possibly ShapeBase.cc?

I'll keep looking.

Thanks again, Bryce!

Tony
#3
04/01/2009 (5:15 am)
Look at game/objectTypes.cc, in the source code. Starting at line 22 is the complete list of typeMasks. I still have yet to figure out how to get the specific type mask of a given object. I know you can do echo(%obj.getType());, but that gives you a number, not a $TypeMask variable.
#4
04/01/2009 (8:45 am)
Here's a 'flow chart' of sorts for you from the official docs. This is the entry for GameBase, which as you'll see is a child of SceneObject (and the main parent, ConsoleObject). Under Gamebase, you'll see ShapeBase, and all of it's children including StaticShapes, Vehicles, Items, and so on.
#5
04/01/2009 (8:50 am)
Also, if you click on the SceneObject (parent of GameBase), you'll see many of the other classes you might be interested in, such as Interiors, TSStatics, WaterBlocks, and so on.
#6
04/02/2009 (4:59 am)
Excellent! Thanks all, very much!!!

Tony
#7
04/02/2009 (8:55 am)
bryce,
since these are masks, a given object can have more than one of them at a time by ORing them together. so %obj.getType() returns the mask that represents all the object types of an object. so it's generally an OR of several $TypeMask variables.

here's a very brute-force routine which might help illustrate:

function SimObject::getTypeStrings(%this)
{
   %types = "";
   %mask  = %this.getType();
   
   %types = %types @ ((%mask & $TypeMasks::StaticObjectType        ) ? "StaticObjectType "         : "");
   %types = %types @ ((%mask & $TypeMasks::EnvironmentObjectType   ) ? "EnvironmentObjectType "    : "");
   %types = %types @ ((%mask & $TypeMasks::TerrainObjectType       ) ? "TerrainObjectType "        : "");
   %types = %types @ ((%mask & $TypeMasks::InteriorObjectType      ) ? "InteriorObjectType "       : "");
   %types = %types @ ((%mask & $TypeMasks::WaterObjectType         ) ? "WaterObjectType "          : "");
   %types = %types @ ((%mask & $TypeMasks::TriggerObjectType       ) ? "TriggerObjectType "        : "");
   %types = %types @ ((%mask & $TypeMasks::AntiPortalObjectType    ) ? "AntiPortalObjectType "     : "");
   %types = %types @ ((%mask & $TypeMasks::ZoneBoxObjectType       ) ? "ZoneBoxObjectType "        : "");
   %types = %types @ ((%mask & $TypeMasks::MarkerObjectType        ) ? "MarkerObjectType "         : "");
   %types = %types @ ((%mask & $TypeMasks::GameBaseObjectType      ) ? "GameBaseObjectType "       : "");
   %types = %types @ ((%mask & $TypeMasks::ShapeBaseObjectType     ) ? "ShapeBaseObjectType "      : "");
   %types = %types @ ((%mask & $TypeMasks::CameraObjectType        ) ? "CameraObjectType "         : "");
   %types = %types @ ((%mask & $TypeMasks::StaticShapeObjectType   ) ? "StaticShapeObjectType "    : "");
   %types = %types @ ((%mask & $TypeMasks::PlayerObjectType        ) ? "PlayerObjectType "         : "");
   %types = %types @ ((%mask & $TypeMasks::ItemObjectType          ) ? "ItemObjectType "           : "");
   %types = %types @ ((%mask & $TypeMasks::VehicleObjectType       ) ? "VehicleObjectType "        : "");
   %types = %types @ ((%mask & $TypeMasks::VehicleBlockerObjectType) ? "VehicleBlockerObjectType " : "");
   %types = %types @ ((%mask & $TypeMasks::ProjectileObjectType    ) ? "ProjectileObjectType "     : "");
   %types = %types @ ((%mask & $TypeMasks::ExplosionObjectType     ) ? "ExplosionObjectType "      : "");
   %types = %types @ ((%mask & $TypeMasks::CorpseObjectType        ) ? "CorpseObjectType "         : "");
   %types = %types @ ((%mask & $TypeMasks::DebrisObjectType        ) ? "DebrisObjectType "         : "");
   %types = %types @ ((%mask & $TypeMasks::PhysicalZoneObjectType  ) ? "PhysicalZoneObjectType "   : "");
   %types = %types @ ((%mask & $TypeMasks::StaticTSObjectType      ) ? "StaticTSObjectType "       : "");
   %types = %types @ ((%mask & $TypeMasks::StaticRenderedObjectType) ? "StaticRenderedObjectType " : "");
   %types = %types @ ((%mask & $TypeMasks::DamagableItemObjectType ) ? "DamagableItemObjectType "  : "");

   %types = trim(%types);
   return %types;
}

example usage:
==>echo($player.getTypestrings());
GameBaseObjectType ShapeBaseObjectType PlayerObjectType
#8
04/04/2009 (8:37 am)
Thanks Orion! I think this is the hundredth time you've helped me!

Tony
#9
04/04/2009 (9:09 am)
my pleasure!