Forráskód Böngészése

colliders final fixes

ncannasse 7 éve
szülő
commit
7fdbd08b27
3 módosított fájl, 15 hozzáadás és 2 törlés
  1. 4 0
      h3d/scene/Box.hx
  2. 6 2
      h3d/scene/Object.hx
  3. 5 0
      h3d/scene/Skin.hx

+ 4 - 0
h3d/scene/Box.hx

@@ -18,6 +18,10 @@ class Box extends Graphics {
 		if( !depth ) material.mainPass.depth(true, Always);
 	}
 
+	override function getLocalCollider() {
+		return null;
+	}
+
 	override function sync(ctx) {
 		if( bounds == null ) {
 			if( prevXMin == -0.5 && prevYMin == -0.5 && prevZMin == -0.5 && prevXMax == 0.5 && prevYMax == 0.5 && prevZMax == 0.5 )

+ 6 - 2
h3d/scene/Object.hx

@@ -432,8 +432,12 @@ class Object implements hxd.impl.Serializable {
 		return new h3d.col.Collider.GroupCollider(colliders);
 	}
 
-	function getGlobalCollider() : h3d.col.Collider {
-		return new h3d.col.ObjectCollider(this, getLocalCollider());
+	/**
+		Same as getLocalCollider, but returns an absolute collider instead of a local one.
+	**/
+	public function getGlobalCollider() : h3d.col.Collider {
+		var col = getLocalCollider();
+		return col == null ? null : new h3d.col.ObjectCollider(this, col);
 	}
 
 	/**

+ 5 - 0
h3d/scene/Skin.hx

@@ -129,6 +129,11 @@ class Skin extends MultiMaterial {
 		return null;
 	}
 
+	override function getLocalCollider() {
+		throw "Not implemented";
+		return null;
+	}
+
 	override function getGlobalCollider() {
 		var col = cast(primitive.getCollider(), h3d.col.Collider.OptimizedCollider);
 		cast(primitive, h3d.prim.HMDModel).loadSkin(skinData);