Game Development Community

Beta4 (fixed): useMouseEvents is broken with CollisionPolyList

by Alex Rice · in Torque Game Builder · 05/27/2006 (2:25 pm) · 6 replies

This object was created in the level editor. It works fine for receiving object mouseEvents
new t2dStaticSprite(egg) {
      imageMap = "eggPROTOImageMap";
      superclass = "MLEggsEgg";
      class = "MLEggsSolidEgg";
      UseMouseEvents = "1";
      position = "-1 2.51401";
      size = "8 8";
      Layer = "12";
      CollisionActiveSend = "1";
      CollisionActiveReceive = "1";
      CollisionPhysicsSend = "0";
      CollisionPhysicsReceive = "0";
      CollisionCallback = "1";
         mountID = "13";
   };
The simple addition of a CollisionPolyList , also created with the Level Editor, breaks object mouseEvents and the callbacks are no longer received.
CollisionPolyList = "0.07 -0.95 -0.20 -0.89 -0.37 -0.63 -0.55 -0.31 -0.62 0.06 -0.61 0.47 -0.29 0.85 0.00 0.93 0.30 0.90 0.56 0.69 0.74 0.41 0.75 0.02 0.53 -0.63 0.30 -0.88";
Does anyone have a workaround for this? I really want to use object mouseEvents it makes my code so much cleaner compared with piping everything through useWindowMouseEvents.

#1
05/27/2006 (2:27 pm)
To replicate, here is the callback function I am testing with
function MLEggsEgg::onMouseDown( %this, %mod, %worldPos, %mouseClicks )
{
	echo("MLEggsEgg::onMouseDown");
}
#2
05/27/2006 (5:04 pm)
The problem is your collision poly. It is defined counter-clockwise but the t2dSceneObject::getIsPointInObject() method can only handle the polygons defined clockwise. (The same will probably be true for the rest of the physics system). Did you create this polygon with the level builder or by hand?
#3
05/27/2006 (10:54 pm)
@Michael- ok thanks I will try that and it was created with the Level Builder!
#4
05/27/2006 (11:11 pm)
This bug was spotted in beta 2, but we couldn't replicate. Thanks for the heads up Michael--good catch!
#5
05/28/2006 (12:13 am)
I re-did my collision poly's in the level builder by clicking in a clockwise direction and now my collisions are working :-)
#6
05/28/2006 (3:17 am)
I'll post this in the bug tracker. Collision polygons created with the level editor should work both ways.