Game Development Community

[Help] Aligning a trigger so it is centered on an object

by Nicolai Dutka · in Torque Game Engine Advanced · 10/07/2009 (7:46 pm) · 4 replies

Ok, I must be working much too long because I can't remember how to get a trigger placed so it is centered on another object. Clearly using 'setTransform' doesn't work in itself because the trigger gets placed based on one of it's corners rather than the center of the trigger. Triggers seem to be the ONLY object that work this way as far as I know and that seems HIGHLY inconsistent, but I digress..

Can someone please tell me how I'd center these triggers?

#2
10/08/2009 (4:36 am)
You know.. I tried that and the trigger still would not center on the object... You'd think after setting the polyhedron to those numbers, you'd be able to do:

trigger.setTransform(object.getTransform());

But I am getting the exact same results...
#3
10/08/2009 (11:11 am)
I set the polyhedron as stated in a "myTrigger" trigger.
I made a staticShape in my world, called "capsule".

And when I execute in the console
myTrigger.setTransform( capsule.getTransform() );
the trigger is centered around the staticShape.

The scale can vary because the transform doesn't include the scale, but the trigger seems to be well located.

Nicolas Buquet
www.buquet-net.com/cv/
#4
10/13/2009 (10:39 pm)
Ok, for some reason this only works when creating new triggers...

I tried setting the polyhedron of an existing trigger and it still snaps to the corner... I tried setting it while making a brand new trigger and it works flawlessly, setting my trigger so it centers on the object in question... THANKS!