TGB 1.6 , 1.7.2 - t2dTrigger problem
by Bruno Campolo · in Torque Game Builder · 03/14/2008 (12:57 pm) · 4 replies
I don't know if this is a bug or just user error, but here goes:
I add a t2dTrigger to my scene and make it about 1/5th of the height of the screen and then entire width (using 800x600 screen and 100x75 in the editor). I made sure the onEnter and onLeave checkboxes were checked. I set the scripting class name to be warningTriggerClass and in my warningTriggerClass.cs file I have:
function warningTriggerClass::onEnter(%this, %object)
{
$icount++;
echo("Enter " @ $icount @ " " @ %object);
}
function warningTriggerClass::onLeave(%this, %object)
{
$icount--;
echo("Leave " @ $icount @ " " @ %object);
}
The output looks like:
Enter 1 1426
Leave 0 1426
Enter 1 1427
Leave 0 1427
Enter 1 1428
Leave 0 1428
Enter 1 1429
Leave 0 1429
Enter 1 1430
Leave 0 1430
Enter 1 1431
Leave 0 1431
This happens even though the mentioned objects have entered the trigger area and NONE of them have actually left.
I've tried different collision/physics options in the scene editor, but no help. And one other weird thing was if I make the trigger area too big (almost the size of the screen area) then it doesn't even trigger at all!!! No echo statements get printed.
I add a t2dTrigger to my scene and make it about 1/5th of the height of the screen and then entire width (using 800x600 screen and 100x75 in the editor). I made sure the onEnter and onLeave checkboxes were checked. I set the scripting class name to be warningTriggerClass and in my warningTriggerClass.cs file I have:
function warningTriggerClass::onEnter(%this, %object)
{
$icount++;
echo("Enter " @ $icount @ " " @ %object);
}
function warningTriggerClass::onLeave(%this, %object)
{
$icount--;
echo("Leave " @ $icount @ " " @ %object);
}
The output looks like:
Enter 1 1426
Leave 0 1426
Enter 1 1427
Leave 0 1427
Enter 1 1428
Leave 0 1428
Enter 1 1429
Leave 0 1429
Enter 1 1430
Leave 0 1430
Enter 1 1431
Leave 0 1431
This happens even though the mentioned objects have entered the trigger area and NONE of them have actually left.
I've tried different collision/physics options in the scene editor, but no help. And one other weird thing was if I make the trigger area too big (almost the size of the screen area) then it doesn't even trigger at all!!! No echo statements get printed.
About the author
Creator of Bantam City Games, a one-man independent game development studio. To learn more, check out 'A Game Developer's Saga', a game development blog at: http://www.bantamcity.com/blog
#2
I reported the same problem back in December but have not found a solution yet.
http://www.garagegames.com/mg/forums/result.thread.php?qt=69845
03/18/2008 (6:48 am)
Bruno, I reported the same problem back in December but have not found a solution yet.
http://www.garagegames.com/mg/forums/result.thread.php?qt=69845
#3
I'll keep exploring and let you know if I find anything useful.
03/18/2008 (4:37 pm)
Hi Patrick, it does seem like one of the problems you reported is the same as what I am experiencing. Did you ever hear back from Matt? It sounded like he was going to look at your source code.I'll keep exploring and let you know if I find anything useful.
#4
switch$ (%object.class)
{
case pBall:
echo("this object has triggered your trigger!:",%object.class);
}
06/11/2008 (8:14 pm)
Hmm. I don't know exactly what your trigger problem is. I can't really piece it togeather from your description. However, tgb 1.7.3 has broken triggers.. they are working on it currently. If you're having a problem with the trigger going off when other objects collide with it other than your intended object write a little filter on your onEnter, onLeave, or onStay callback, like this:switch$ (%object.class)
{
case pBall:
echo("this object has triggered your trigger!:",%object.class);
}
Torque Owner Bruno Campolo
It seems that the trigger can only have 1 object inside of the trigger area at once. When one object enters the trigger area it forces the trigger's onLeave callback for the previous object, before calling the onEnter call back for the new object. This happens eventhough both objects are still in the trigger area!
This doesn't sound right to me. I would think multiple objects can be in the trigger area at once, right?
Can anyone confirm that this is a bug?