sorry again.
i do it in this form, is it right?
var cube1 = BABYLON.MeshBuilder.CreateBox(“box”, { size: 1 }, scene);
cube1.position.x = 2;
var cube2 = BABYLON.MeshBuilder.CreateBox(“bo2”, { size: 1 }, scene);
cube2.position.x = 4;
var cube3 = BABYLON.MeshBuilder.CreateBox(“box3”, { size: 1 }, scene);
cube3.position.x = 6;
var cube4 = BABYLON.MeshBuilder.CreateBox(“box4”, { size: 1 }, scene);
cube4.position.x = -2;
var cube5 = BABYLON.MeshBuilder.CreateBox(“box5”, { size: 1 }, scene);
cube5.position.x = -4;
var mat = new BABYLON.StandardMaterial(“mat”, scene);
mat.diffuseColor = new BABYLON.Color3(0, 0, 1);
cube3.material = mat;
var boxG = BABYLON.MeshBuilder.CreateBox(
“box”,
{ height: 1, width: 1, depth: 1 },
scene
);
boxG.position.y = 2;
const mat2 = new BABYLON.StandardMaterial(“mat2”, scene);
mat2.diffuseColor = new BABYLON.Color3(1, 0, 0);
boxGmaterial = mat2;
// initialize GizmoManager
var gizmoManager = new BABYLON.GizmoManager(scene);
gizmoManager.boundingBoxGizmoEnable = true;
// gizmoManager.attachableMesh = box;
gizmoManager.positionGizmoEnabled = true;
gizmoManager.boundingBoxGizmoEnabled = true;
gizmoManager.usePointerToAttachGizmos = false;
gizmoManager.attachToMesh(boxG);
boxG.visibility = 0.3;
boxG.computeWorldMatrix(true); //force any transformations
let inX =
boxG.getBoundingInfo().boundingBox.minimumWorld.x <
boxG.getBoundingInfo().boundingBox.minimumWorld.x <
cube1.getBoundingInfo().boundingBox.minimumWorld.x &&
cube1.getBoundingInfo().boundingBox.maximumWorld.x <
boxG.getBoundingInfo().boundingBox.maximumWorld;
let inY =
boxG.getBoundingInfo().boundingBox.minimumWorld.y <
cube1.getBoundingInfo().boundingBox.minimumWorld.y &&
cube1.getBoundingInfo().boundingBox.maximumWorld.y <
boxG.getBoundingInfo().boundingBox.maximumWorld;
let inZ =
boxG.getBoundingInfo().boundingBox.minimumWorld.z <
cube1.getBoundingInfo().boundingBox.minimumWorld.z &&
cube1.getBoundingInfo().boundingBox.maximumWorld.z <
boxG.getBoundingInfo().boundingBox.maximumWorld;
let inside = inX && inY && inZ;