Browse Source

reverse sortHitPointByCameraDistance
reset hitInteractives if not propagate

bstouls 9 years ago
parent
commit
aea3a41a41
1 changed files with 6 additions and 4 deletions
  1. 6 4
      h3d/scene/Scene.hx

+ 6 - 4
h3d/scene/Scene.hx

@@ -36,8 +36,8 @@ class Scene extends Object implements h3d.IDrawable implements hxd.SceneEvents.I
 		var z1 = i1.hitPoint.w;
 		var z2 = i2.hitPoint.w;
 		if( z1 > z2 )
-			return 1;
-		return -1;
+			return -1;
+		return 1;
 	}
 
 	public function dispatchEvent( event : hxd.Event, to : hxd.SceneEvents.Interactive ) {
@@ -90,10 +90,9 @@ class Scene extends Object implements h3d.IDrawable implements hxd.SceneEvents.I
 				hitInteractives.sort(sortHitPointByCameraDistance);
 			}
 
-			hitInteractives.push(null);
+			hitInteractives.unshift(null);
 		}
 
-
 		while( hitInteractives.length > 0 ) {
 
 			var i = hitInteractives.pop();
@@ -111,6 +110,9 @@ class Scene extends Object implements h3d.IDrawable implements hxd.SceneEvents.I
 				continue;
 			}
 
+			if( !event.propagate )
+				hitInteractives = [];
+
 			return i;
 		}