浏览代码

Fix MeshBatch getBoundsRec as primitive pos is already transformed.

clandrin 3 年之前
父节点
当前提交
d99863be63
共有 1 个文件被更改,包括 11 次插入0 次删除
  1. 11 0
      h3d/scene/MeshBatch.hx

+ 11 - 0
h3d/scene/MeshBatch.hx

@@ -257,6 +257,17 @@ class MeshBatch extends MultiMaterial {
 		needUpload = true;
 	}
 
+	override function getBoundsRec( b : h3d.col.Bounds ) {
+		var old = primitive;
+		primitive = null;
+		b = super.getBoundsRec(b);
+		primitive = old;
+		if( primitive == null || flags.has(FIgnoreBounds) )
+			return b;
+		b.add(primitive.getBounds());
+		return b;
+	}
+
 	public function emitInstance() {
 		if( worldPosition == null ) syncPos();
 		var ps = primitiveSubPart;