Game Development Community

Tank pack and triggers

by kcpdad · in Torque Game Engine · 05/27/2005 (12:46 pm) · 4 replies

Hi,
I'm integrating the tank pack and the CTF resources. When I add a trigger mission object the tank just collides with the trigger box as if it was hitting a wall, no trigger script call back functions are invoked. I looked at the tank pack code, tankshape.cc and it doesn't look like triggers have been implemented. Is this true and has anyone put triggers into the tank pack? I'm going to give it a shot myself but this code is a little advanced for my current understanding of the engine. Any suggestions or pointers would be appreciated, thx
Thanks,
Joe

About the author

Hobbyist working on a tank game when time allows. Play the prototype at => http://www.sytrept.com/60tons/


#1
05/27/2005 (5:28 pm)
Hi,
After posting this, I noticed this post, here, from yesterday. It pretty much contained my answer.
I changed TankShape.cc by adding
#include "game/trigger.h"
and changing
while (eopList != &eorList)
   {
      if ((eopList->mConvex->getObject()->getType() & mask) != 0)
      {
         Box3F convexBox = eopList->mConvex->getBoundingBox();
         if (wBox.isOverlapped(convexBox))
            eopList->mConvex->getPolyList(&sPolyList);
      }
      eopList = eopList->wLink.mNext;
   }

to
while (eopList != &eorList)
   {
      if (eopList->mConvex->getObject()->getType() & TriggerObjectType) 
	  {
          Trigger* pTrigger = static_cast<Trigger*>(eopList->mConvex->getObject());
          pTrigger->potentialEnterObject(this);
      }
	  else if ((eopList->mConvex->getObject()->getType() & mask) != 0)
      {
         Box3F convexBox = eopList->mConvex->getBoundingBox();
         if (wBox.isOverlapped(convexBox))
            eopList->mConvex->getPolyList(&sPolyList);
      }
      eopList = eopList->wLink.mNext;
   }
This seems to work with one player, I'm gonna check client/server next.
#2
05/28/2005 (8:25 am)
Off topic, but thanks a lot for posting the cross-link to the answer you found! It makes things much easier for people that find your thread in future searches.
#3
02/03/2007 (4:21 am)
Much needed, thanks.
My tanks are now activating and not stopping on triggers.
TGE 1.5.
#4
02/03/2007 (5:24 am)
You're welcome. Let us know if you have other tank problems, I'm a bit more advanced in my tank knowledge since I first wrote this post.