Parcourir la source

fixed constraints in prefab instances

Nicolas Cannasse il y a 5 ans
Parent
commit
7a4217380e
1 fichiers modifiés avec 5 ajouts et 1 suppressions
  1. 5 1
      hrt/prefab/l3d/Instance.hx

+ 5 - 1
hrt/prefab/l3d/Instance.hx

@@ -22,8 +22,12 @@ class Instance extends Object3D {
 					var ref = ctx.shared.loadPrefab(modelPath);
 					var ctx = ctx.clone(this);
 					ctx.isRef = true;
-					if(ref != null)
+					if(ref != null) {
+						var prev = ctx.shared.root3d;
+						ctx.shared.root3d = ctx.local3d; // allows Context.locateObject to work (constraints)
 						ref.make(ctx);
+						ctx.shared.root3d = prev;
+					}
 				}
 				else {
 					var obj = ctx.loadModel(modelPath);