Game Development Community

Help with subObjects

by Erik Madison · in Torque Game Engine · 07/11/2003 (6:15 am) · 6 replies

I'm trying to expand upon the use of subobjects, namely checking collisions. As mirrors are the only subtypes currently in the game, I don't have much to study off of.
I think where I need to check (at least for now) would be in Player::updatePos()
// Track collisions
         if (!isGhost() && collision->object->getTypeMask() & ShapeBaseObjectType) {
            ShapeBase* col = static_cast<ShapeBase*>(collision->object);
            queueCollision(col,mVelocity - col->getVelocity());
         }
		 //// subObject collision testing
 	     U32 objectMask = collision->object->getTypeMask();
         if (objectMask & InteriorObjectType) { 
           Con::errorf("Touching an interior(updatePos)"); 
		 }     
         ////
      }
      else
Okay, that works fine. I get a message every time I touch an interior. Now, I need to somehow refine my test to know if the interior contains a subObject, and additionally which type (enum MirrorSubObjectType).
Any help please?

#1
07/11/2003 (1:58 pm)
Help?
#2
07/11/2003 (10:53 pm)
I guess I'm a little unclear on what you're trying to do... Could you elaborate?

(I see from a technical standpoint, but I don't see how it would be useful, I mean.)
#3
07/11/2003 (11:34 pm)
Ok, this could take a while :)

Currently there is no interface to enumerate subobjects
either inside the Interior class, nor is there an interface provided within the InteriorInstance class.

But there is access available in the InteriorResource class.

there are a couple ways to do things tho.

1.) provide handling inside your instance code (InteriorInstance)
this class has an mInteriorSubObjects multidimensional array.
for Mirrors you can access them here.

2.) Operate handling via determining which resource to pull from the ResourceManager (you can get this from the InteriorInstance)
and then from there you can access directly the sub object.
this is prolly not the way to do it.

Now from there depending on what you want to do, ...
#4
07/12/2003 (6:56 am)
Okay, it's #1 I want, and thats what I'm not sure how to access from where I'm at.
My long term goal is to add buttloads of entities, ala HalfLife. Short term is the entities that respond to touch, which is why I somehow need to find the InteriorSubObject* from the info I have available, which is Shapebase*.
The first entity I'm working on is ladders, ropes, vines. I think the best method is to use a surface entitie (like mirrors), and tag one plane to be climbable surface. In my above code, once I know for a fact the surface is touched, I can set a variable (mClimbing). Later in updateMove() if the variable is set, and based on the entities flags, I will adjust/change the velocity of the player to be climbing.
What I _don't_ want, is any entities that are tied to a datablock, which requires editing with the ingame editor, such as triggers are. If I went that route, this would be much easier on me (I already had that method working once), but it would be much harder on the builders. They need to create everything in Quark/Hammer.
#5
07/12/2003 (7:01 am)
An easy method I also tried, was to make new types, ie InteriorObjectType (1<
// Subobjects: Doors, translucencies, mirrors, etc.
   Vector<InteriorSubObject*> mSubObjects;
#6
07/12/2003 (9:47 am)
Yea ..
I dont think you should use the Interior tho.

if Anything you should use the InteriorInstance.

if you dont see an immediate way to gain access,
you should write supportive functions in this class to access the sub objects.

Mostly becuase you want to perform collision, therefore there is some instance specific attributes you will need to access.