Some questions about type masks
by Kareem Ergawy · in Torque 3D Beginner · 09/19/2014 (12:38 am) · 4 replies
Hello,
Regarding type masks, I have a few questions:
1 - How are type masks mapped to different Source Classes? I mean how can I know what type mask is assigned to this specific object type? I didn't find any way to do that.
2 - Can I define new type masks? By that I mean from scripts or editor and not from the source code.
Regarding type masks, I have a few questions:
1 - How are type masks mapped to different Source Classes? I mean how can I know what type mask is assigned to this specific object type? I didn't find any way to do that.
2 - Can I define new type masks? By that I mean from scripts or editor and not from the source code.
#2
$TypeMasks
CameraObjectType
CorpseObjectType
DebrisObjectType
DynamicShapeObjectType
EnvironmentObjectType
ExplosionObjectType
GameBaseObjectType
InteriorObjectType
ItemObjectType
LightObjectType
MarkerObjectType
PhysicalZoneObjectType
PlayerObjectType
ProjectileObjectType
ShapeBaseObjectType
StaticObjectType
It's a list I made and keep handy for when I just need to remember quickly the exact name in script of a particular object. I've seen the type StaticTSObjectType thrown around before, but I think StaticObjectType might encompass TSStatics as well. Hoping it helps, cheers.
09/19/2014 (9:52 am)
As always, Steve gives good advice. Understanding how 'hidden' some things can be, however, take a look at this:$TypeMasks
CameraObjectType
CorpseObjectType
DebrisObjectType
DynamicShapeObjectType
EnvironmentObjectType
ExplosionObjectType
GameBaseObjectType
InteriorObjectType
ItemObjectType
LightObjectType
MarkerObjectType
PhysicalZoneObjectType
PlayerObjectType
ProjectileObjectType
ShapeBaseObjectType
StaticObjectType
It's a list I made and keep handy for when I just need to remember quickly the exact name in script of a particular object. I've seen the type StaticTSObjectType thrown around before, but I think StaticObjectType might encompass TSStatics as well. Hoping it helps, cheers.
#3
I would have suggested searching the project for "typemask" - you'll find a pile of hits....
Jesse is more helpful - which is good. I like to make people work for it! (Then again, look at my name....)
[EDIT]
Ok, to be nice:
09/19/2014 (10:32 am)
Yeah, Steve is a little terse and I usually am, too.I would have suggested searching the project for "typemask" - you'll find a pile of hits....
Jesse is more helpful - which is good. I like to make people work for it! (Then again, look at my name....)
[EDIT]
Ok, to be nice:
/// Types used for SceneObject type masks (SceneObject::mTypeMask)
///
/// @note If a new object type is added, don't forget to add it to
/// RegisterGameFunctions().
enum SceneObjectTypes
{
/// @name Types used by the SceneObject class
/// @{
/// Default value for type masks.
DefaultObjectType = 0,
/// @}
/// @name Basic Engine Types
/// @{
/// Any kind of SceneObject that is not supposed to change transforms
/// except during editing (or not at all).
StaticObjectType = BIT( 0 ),
/// Environment objects such as clouds, skies, forests, etc.
EnvironmentObjectType = BIT( 1 ),
/// A terrain object.
/// @see TerrainBlock
TerrainObjectType = BIT( 2 ),
/// An object defining a water volume.
/// @see WaterObject
WaterObjectType = BIT( 3 ),
/// An object defining an invisible trigger volume.
/// @see Trigger
TriggerObjectType = BIT( 4 ),
/// An object defining an invisible marker.
/// @see MissionMarker
MarkerObjectType = BIT( 5 ),
/// A light emitter.
/// @see LightBase
LightObjectType = BIT( 6 ),
/// An object that manages zones. This is automatically set by
/// SceneZoneSpaceManager when a SceneZoneSpace registers zones. Should
/// not be manually set.
///
/// @see SceneZoneSpace
/// @see SceneZoneSpaceManager
ZoneObjectType = BIT( 7 ),
/// Any object that defines one or more solid, renderable static geometries that
/// should be included in collision and raycasts.
///
/// Use this mask to find objects that are part of the static level geometry.
///
/// @note If you set this, you will also want to set StaticObjectType.
StaticShapeObjectType = BIT( 8 ),
/// Any object that defines one or more solid, renderable dynamic geometries that
/// should be included in collision and raycasts.
///
/// Use this mask to find objects that are part of the dynamic game geometry.
DynamicShapeObjectType = BIT( 9 ),
/// @}
/// @name Game Types
/// @{
/// Any GameBase-derived object.
/// @see GameBase
GameBaseObjectType = BIT( 10 ),
/// An object that uses hifi networking.
GameBaseHiFiObjectType = BIT( 11 ),
/// Any ShapeBase-derived object.
/// @see ShapeBase
ShapeBaseObjectType = BIT( 12 ),
/// A camera object.
/// @see Camera
CameraObjectType = BIT( 13 ),
/// A human or AI player object.
/// @see Player
PlayerObjectType = BIT( 14 ),
/// An item pickup.
/// @see Item
ItemObjectType = BIT( 15 ),
/// A vehicle.
/// @see Vehicle
VehicleObjectType = BIT( 16 ),
/// An object that blocks vehicles.
/// @see VehicleBlocker
VehicleBlockerObjectType = BIT( 17 ),
/// A weapon projectile.
/// @see Projectile
ProjectileObjectType = BIT( 18 ),
/// An explosion object.
/// @see Explosion
ExplosionObjectType = BIT( 19 ),
/// A dead player. This is dynamically set and unset.
/// @see Player
CorpseObjectType = BIT( 20 ),
/// A debris object.
/// @see Debris
DebrisObjectType = BIT( 21 ),
/// A volume that asserts forces on player objects.
/// @see PhysicalZone
PhysicalZoneObjectType = BIT( 22 ),
/// @}
};Interesting to see that 23 of the 32 are in use... nice, room to grow!
#4
09/19/2014 (10:37 am)
Thank you guys for the info and for the pointers in the code so that I can learn more about it.
Associate Steve Acaster
[YorkshireRifles.com]
2. No, not in script. Look in engine/T3D/objectTypes.h for a full list of typemasks. You can create new class objects (in code obvisouly) and rename/reuse typemasks. There's a limit to the number of available typemasks due to Torque being 32-bit.