Game Development Community

T3D MIT Trigger Bug

by Jack Stone · in Torque 3D Professional · 01/21/2014 (7:53 pm) · 25 replies

I am having some unusual problems with the Triggers in the current release of T3D MIT.

When creating triggers in the mission editor as usual, only some of them are working. My triggers are all the exact same, with the exception of the position. Same datablock, same scale values, etc etc.
I have six triggers in the level, and I can only get four of them to work, at best.

Implementing the fix described here: (in post 4)
https://www.garagegames.com/community/forums/viewthread/135658

Did nothing until I also made the same change in the "ConsoleSetType" function here:
U32 numArgs = dSscanf(argv[0], "%g %g %g %g %g %g %g %g %g %g %g %g",
                         &origin.x, &origin.y, &origin.z,
                         &vecs[0].x, &vecs[0].y, &vecs[0].z,
                         &vecs[2].x, &vecs[2].y, &vecs[2].z,//here
                         &vecs[1].x, &vecs[1].y, &vecs[1].z);//and here

This cause the two triggers that were previously not working to start working again, but... the four that were working stopped working...

This is clearly an issue with the winding order of the polys being used to build up the trigger object. What seems to be happening is that sometimes a trigger is created with reversed polys, causing it to fail.
I have tried creating the triggers in script, copying working triggers, etc, but to no avail.
My trigger code is very simple:

datablock TriggerData(LowCoverTrigger)
{
   tickPeriodMS = 100;
};

function LowCoverTrigger::onEnterTrigger(%this,%trigger,%obj)
{
			echo("ENTER: " @ %obj);
}

function LowCoverTrigger::onLeaveTrigger(%this,%trigger,%obj)
{
	echo("EXIT: " @ %obj);
}


   new Trigger() {
      polyhedron = "-0.5000000 0.5000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 -1.0000000 0.0000000";
      dataBlock = "LowCoverTrigger";
      position = "8.38168 0.249492 238.899";
      rotation = "1 0 0 0";
      scale = "4 1 5";
      canSave = "1";
      canSaveDynamicFields = "1";
       triggerOff = "0";  
   };

As I said, there are six triggers, all identical to the one above except for the position, only four (or two) work.

I'm not sure where to go to solve this, but I'm fairly confident in calling it a bug, I can't see anything I could have done that would cause this.
Page«First 1 2 Next»
#21
06/07/2014 (6:27 pm)
I have been having some difficulty with triggers again, and I think I may have discovered something new.

I have noticed that in my most recent project (with a synced, current build of T3D from Github) the trigger that I have placed will not fire if the trigger poly is partially or completely intersecting with another game object. However, the same trigger, when moved slightly so that no part of it touches any other object, will work perfectly.

I don't remember checking for this with my original issue above, but it seems like a bug to me, since triggers could often be used by intersecting them other objects, such as a trigger contained within a doorway, or blocking a passage.

Can anyone confirm this?
#22
06/08/2014 (6:37 am)
That sounds like it could have been the problem I was seeing with our mechs since they are so large. I ended up just writing specialized code to fix the triggers as a stop gap for now. I debugged for a while but I did not see the issue. It would always fail in the same spot in the earlyoutpoly check
#23
06/09/2014 (10:30 am)
Thanks Tim, at least I know it's not just my build! I'm surprised noone has found a solution to this yet?
#24
06/09/2014 (1:41 pm)
The change i made was to just do a world box intersect instead of an earlyoutpoly check. Im not really even positive as to why it doesnt just do that anyway.
#25
10/13/2015 (1:33 am)
Try a different setup of the polyhedron. Default the editor uses:

polyhedron = "-0.5 0.5 0.0 1.0 0.0 0.0 0.0 -1.0 0.0 0.0 0.0 1.0"

But leave the first 2 values at 0 instead:

polyhedron = "0.0 0.0 0.0 1.0 0.0 0.0 0.0 -1.0 0.0 0.0 0.0 1.0"

The pivot will move up to a side instead of the middle of the box bottom.

We had issues and solved this way; hopefully for good!
Page«First 1 2 Next»