Game Development Community

setting up triggers

by Martin Banks · in Torque 3D Professional · 09/08/2009 (3:42 pm) · 8 replies

I created a trigger with the defaulttrigger as its datablock. I am attempting to simply pop a message box when my character enters the trigger bounds, but nothing is happening.

Do I need to do something else in order for the trigger to call its callbacks?

#1
09/08/2009 (3:49 pm)
Yes,you need to use the onEnterTrigger callback.

function YourTrigger::onEnterTrigger(%this,%trigger,%obj)
{  echo("....");
}
#2
09/08/2009 (3:55 pm)
@Picasso, I used the defaultTrigger. Those methods are defined in trigger.cs. I amended them to pop a message box when they are called. However, they aren't being called.
#3
09/08/2009 (4:01 pm)
OK,where is your datablock ?
I think you should copy this at the begining of triggers.cs:

datablock TriggerData(SomeTrigger)
{
   tickPeriodMS  = 96;
   triggerSize = "5 5 5";
   
   // box center a little off-center from middle of bottom of box
   polyhedronCenter = "-0.5 0.5 0.0";
   className = DefaultTrigger;
};
#4
09/08/2009 (4:17 pm)
my datablock is the default trigger, defined in trigger.cs
datablock TriggerData(DefaultTrigger)
{
   // The period is value is used to control how often the console
   // onTriggerTick callback is called while there are any objects
   // in the trigger.  The default value is 100 MS.
   tickPeriodMS = 100;
};
#5
09/08/2009 (4:23 pm)
I had some problems with triggers in TGEA which were solved like in this thread www.garagegames.com/community/forums/viewthread/34607
#6
09/08/2009 (4:42 pm)
hmmm....so does that mean that all of the objects/shapes have to be in the same group as the trigger? If so, does that mean that missioncleanup objects can only trip triggers that are in the missioncleanup group?
#7
09/08/2009 (5:06 pm)
Martin: To tell the truth. I don't know. Maybe someone else do
#8
09/09/2009 (6:44 pm)
Ok, so all of the objects/shapes don't have to be in the same group to trip the trigger.

After experiencing weirdness, by noticing that moving the trigger space around my character's knees, it was activating and I was able to get it workin. I then adjusted the sizes to make the trigger volumes fatter, and they began to work.

So it seems that thin trigger volumes can give a little whackiness, but it is workable.