MTypeMask question
by Demolishun · in Torque Game Engine · 09/10/2006 (7:06 pm) · 2 replies
I have created a new base class for my objects. I tried using the ShapeBaseObjectType as this was a similarly functioning class. I also read somewhere that I should not make up new masks if existing similarly functioning masks were available. Because I used the same mask the "onRender" function in "guiShapeNameHud.cc" crashed here:
The questions I have are these:
1) How many mask bits are possible? 64?
2) Is there a more robust way to detect the type of object other than "mTypeMask" checks?
3) Is gamebase still recommended for new object types?
I changed my mTypeMask to one I created and everything works fine. Obviously this HUD does not see my object, but that is okay.
Thanks
if ((*itr)->getType() & ShapeBaseObjectType)
{
ShapeBase* shape = static_cast<ShapeBase*>(*itr);
if (shape != control && shape->getShapeName())The questions I have are these:
1) How many mask bits are possible? 64?
2) Is there a more robust way to detect the type of object other than "mTypeMask" checks?
3) Is gamebase still recommended for new object types?
I changed my mTypeMask to one I created and everything works fine. Obviously this HUD does not see my object, but that is okay.
Thanks
About the author
I love programming, I love programming things that go click, whirr, boom. For organized T3D Links visit: http://demolishun.com/?page_id=67
#2
2. Oh, so that function excerpt may have faired better if they had used a dynamic cast it looks like.
3. definitely need that so gamebase it is
This explains quite a bit. I was building my objects on Shapebase, PlayerBase and vehicleBase, but realized if I really wanted to understand how all this works then I needed to make my own stuff. Besides, I will eventually be creating dragons and I definitely do not want shell casing coming out of its belly!
Thanks
09/11/2006 (6:42 pm)
1. make enum long if necessary, could be a way to avoid naming collisions as well2. Oh, so that function excerpt may have faired better if they had used a dynamic cast it looks like.
3. definitely need that so gamebase it is
This explains quite a bit. I was building my objects on Shapebase, PlayerBase and vehicleBase, but realized if I really wanted to understand how all this works then I needed to make my own stuff. Besides, I will eventually be creating dragons and I definitely do not want shell casing coming out of its belly!
Thanks
Associate Kyle Carter
2. Sure - you can get the class name or do a dynamic_cast
3. Depends what you're doing - if you need datablocks, ticking, rendering, and networking it's a great choice. Otherwise there might be better options. (SceneObject if you just need to render, NetObject if you just need to networking, SimObject if you just need scripting, etc. etc. etc.)