Game Development Community

Round triggers?

by Lee Latham · in Torque Game Engine · 03/28/2008 (11:17 pm) · 9 replies

Is it possible to have triggers that are not cubes? ie. cylinders, spheres, etc.?

#1
03/29/2008 (1:43 am)
Sure. Just make a dts and script your onCollision to trigger what you need.
#2
03/29/2008 (3:20 am)
Huh. That's a good idea, thanks!

Hmm wait if I make a dts with no collision mesh, would onCollision still be called? Players need to be able to move freely through this trigger (it's a scoring trigger).
#3
03/29/2008 (7:51 am)
The code that determines "triggering" seems like it would be far more complicated for boxes than for spheres. Perhaps a subclass of spherical trigger could be built.
#4
03/29/2008 (8:06 am)
That's...really weird. Of course, could Torque detect a true sphere's collision?
#5
03/29/2008 (9:50 am)
You can specify different shapes for triggers. The default poly is a cube, but you can edit it in the world editor. See the polyhedron field. You should able to specify any convex shape.

So you can either specify a cylinder or sphere with some level of simplification as a convex, or you could simply do a radius check when an object enters the trigger to see if it is within the area you want. So just test the distance from the trigger to the object that enters (2d for cylinder 3d for sphere). This probably simpler then specifying complex trigger shapes to do the same.

You could also put this into a datablock's name space effectively giving you a class of triggers for cylinders or spheres.

Gabriel
#6
03/29/2008 (11:17 am)
Quote:Hmm wait if I make a dts with no collision mesh, would onCollision still be called?
Yes, but only if it's an "item". (not positive if that's the only way tho)
#7
03/29/2008 (6:13 pm)
Hmm, interesting ideas, y'all, thanks.

I had looked at trying to edit the polyhedron, but my edits didn't seem to make any change to the shape. Perhaps I need to try more carefully...
#8
03/29/2008 (8:02 pm)
Despite the field name, 'polyhedron', it can actually only be boxed shape.
#9
03/30/2008 (12:28 am)
Whoops should have tested that first. I haven't tried any other shapes myself, just assumed it was point cloud that would be converted to a convex.

Gabriel