Game Development Community

Are Triggers Broken in 1.0.1 and 1.1? - LOGGED

by PGames · in Torque 3D Professional · 04/12/2010 (4:20 pm) · 4 replies

I am unable to get triggers working in 1.0.1 or 1.1 beta 1. I traced the onEnterTrigger function into the engine code to see where it gets called, then from there I traced it back to see why it wasn't getting called.

In 1.0.1 I traced it back to this code in player.cpp:

if ( mPhysicsPlayer )
      mPhysicsPlayer->findContact( &contactObject, contactNormal );
   else
      _findContact( &contactObject, contactNormal );


The trigger code is in _findContact(), but the player is a PhysX object so findContact() (without the underscore) is called instead. So I figured that maybe this had been fixed in 1.1, and it turns out that it has to some extent, but the error is now in a different place. The call to the trigger code was refactored out of _findContact() and into a universal findContact() function from which the other two findContact functions are called. Here is the call to the PhysX player:

mPhysicsRep->findContact( &contactObject, contactNormal, &overlapObjects );


It gives us a list of objects that are overlapped by the player object, which it looks in to see if the player is physically overlapping a trigger object. This is all well and good, except that overlapObjects is never filled in when it's passed into the PhysX player's findContact() function.

Are triggers actually broken? Does anyone know how to fix this? Am I misunderstanding the code?

#1
04/13/2010 (4:28 am)
well I'm still on 1.0.1 but I've not had luck with setting them in triggers.cs but they seem to work if you set them via the world editor.
#2
04/13/2010 (5:44 pm)
Can you be more specific? I have tried placing triggers using the world editor and then setting the enterCommand, leaveCommand, and tickCommand to no avail. Whatever I set as the command never seems to get called. Here is an image of my settings:

lh5.ggpht.com/_f-YRgqWJUQg/S8UPjS2mkTI/AAAAAAAACLQ/50AGR5BljS0/s640/trigger.jpg
#3
04/27/2010 (6:21 pm)
Triggers with non-stock torque physics (eg. PhysX) are functional in the trunk and should be in the next release. This was fixed right around GDC, so pretty recently.
#4
06/14/2010 (12:08 pm)
Logged: TQA-371