diff --git a/app/src/main/java/org/ntlab/radishforandroidstudio/framework/physics/BoundingBoxVisitor.java b/app/src/main/java/org/ntlab/radishforandroidstudio/framework/physics/BoundingBoxVisitor.java index b1e6038..0c5fa00 100644 --- a/app/src/main/java/org/ntlab/radishforandroidstudio/framework/physics/BoundingBoxVisitor.java +++ b/app/src/main/java/org/ntlab/radishforandroidstudio/framework/physics/BoundingBoxVisitor.java @@ -47,7 +47,7 @@ BoundingSphere bs = (BoundingSphere)obj.bs.clone(); for (int i = stackList.size() - 1; i >= 0; i--) { obb.transform(stackList.get(i)); - bs.transform(stackList.get(i)); + if (i >= stackList.size() - 4) bs.transform(stackList.get(i)); } if (partName == null || partName.length() == 0 || inPart) { obbList.add(obb); // Transform3Dを適応させたBoundsをboundsListに追加 @@ -72,12 +72,16 @@ stackTop--; } if (obj.bs != null && stackTop >= 0) { + BoundingSphere bs = (BoundingSphere)obj.bs.clone(); + for (int i = stackList.size() - 1; i >= stackList.size() - 4; i--) { + bs.transform(stackList.get(i)); + } if (bsStack.get(stackTop) == null) { // その階層の最初のオブジェクトの場合、nullを置き換え - bsStack.set(stackTop, obj.bs); + bsStack.set(stackTop, bs); } else { // その階層の2番目以降のオブジェクトの場合、結合 - bsStack.get(stackTop).combine(obj.bs); + bsStack.get(stackTop).combine(bs); } } } @@ -90,4 +94,4 @@ public ArrayList getObbList() { return obbList; } -} +} \ No newline at end of file