Game Development Community

Trigger rotation bug

by Brett Fattori · in Torque Game Engine · 08/10/2003 (7:38 pm) · 2 replies

I don't know about all of you, but this is a BUG to me... When you rotate a trigger in the editor, it is rotating around the box center, yet the point that it stores for position is the corner of the trigger box.

Honestly, if triggers are to work properly, the trigger collision box should be calculated from the box center, not the corner. When you rotate a trigger, the position changes according to the position of the corner relative to the center point.

When you're doing manipulations on the trigger from script, the expected result is way off. I've been trying to write a function to transform a trigger to always surround an object. I create the object, according to a marker in the scene, and set it's transform. When I create a trigger and set it with the same position/rotation, it is not surrounding the object. When the object is rotated with (1 0 0 0) it acts fine. But as you rotate around the Z axis, the trigger box will "slide" out of position.

Someone, please, either post a simple fix -- or let's get this into the engine and see what we can do. Maybe a function to do the translation for us? I'm attempting this, but it's a little over my head mathematically).

- Brett

#1
08/11/2003 (9:23 am)
Hey! That sounds like a bug to me :)
Really, I never noticed/payed attention to that... and yes a fix should be placed on the HEAD... I have no 3d accel on my laptop yet though :( can't run torque.
#2
08/11/2003 (1:01 pm)
My brother did a little calculation for this that search the center of the trigger in script. Not really sure, but I think he look for the xyz scale, then /2. For exemple, if x = 3.0, then x /2 = 1.5 (center of x), same for yz. Brother do all the script so I'm not sure exactly where he does this and he is not here for a week, but I think you just have to write a function that calculate all the trigger's center, then call it. Like I said, I'm not sure this is the way he does it. He just said me once that he had a problem because it was on the corner, then he repaired it by script :) and it's working great now.