Selaa lähdekoodia

Apply hierarchy transform on world models

trethaller 7 vuotta sitten
vanhempi
commit
9db91f1452
1 muutettua tiedostoa jossa 6 lisäystä ja 0 poistoa
  1. 6 0
      h3d/scene/World.hx

+ 6 - 0
h3d/scene/World.hx

@@ -256,6 +256,12 @@ class World extends Object {
 			var geom = lib.header.geometries[m.geometry];
 			if( geom == null ) continue;
 			var pos = m.position.toMatrix();
+			var parentIdx = m.parent;
+			while(parentIdx >= 0) {
+				var parent = models[parentIdx];
+				pos.multiply(parent.position.toMatrix(), pos);
+				parentIdx = parent.parent;
+			}
 			for( mid in 0...m.materials.length ) {
 				var mat = lib.header.materials[m.materials[mid]];
 				if(mat == null || mat.diffuseTexture == null) continue;