Game Development Community

Triggers don't work

by Abhinav Chokhavatia · in Torque Game Builder · 06/03/2008 (6:22 am) · 2 replies

Hey guys!

I have a problem with triggers and was not sure where to post it so am posting it here.


I have been working on a game and I wanted to incorporate One Way Platforms into them. I am using a trigger around the platform to turn on/off the collision of the platform whenever my player enters/exits the trigger area. But some bugs have popped up. My trigger is detecting the object entering the trigger area but when my object leaves the trigger area, it is not detected. Instead my object continuously remains in the trigger area, even when it is not there. I checked that using an echo statement. Why aren't my triggers working like they should?

I have attached my code below.

Thanks!

if (!isObject(OneWayPlatformBehavior))
{
   %template = new BehaviorTemplate (OneWayPlatformBehavior);
   
   %template.friendlyName = "One Way Platform Behavior";
   %template.behaviorType = "AI";
   %template.description = "Platforms collide only one way";
}

function OneWayPlatformBehavior::onEnter (%this, %object)
{
   echo ("Entered!");
   echo (%object.class);
}

function OneWayPlatformBehavior::onStay (%this, %object)
{
   echo ("Inside!");
   echo(%object.class);
}

function OneWayPlatformBehavior::onLeave (%this, %object)
{
   echo ("Left trigger area!");   
}

#1
06/04/2008 (4:25 pm)
Have you checked the console.log file? If not start there. Otherwise, you could try using trace.

trace(1); //enable tracing
trace(0); //disable tracing

Sorry, but that's all I could come up with...
#2
06/04/2008 (7:44 pm)
There is a problem with t2dTriggers in 1.7.3. A hotfix has not been uploaded yet.