Quiero las paredes directamente detrás del piso sin ningún espacio y no en el piso interior.
Actualmente, se muestra correctamente para mí, pero no creo que la forma en que lo he escrito sea correcta.
Esta es mi función generar la habitación (piso y paredes) y la quiero más corta y mejor.
function generateRoom(w, d) { var room = new THREE.Object3D(); // Floor var material1 = new THREE.MeshPhongMaterial({ color: 'rgb(255, 255, 255)', }); var material2 = new THREE.MeshPhongMaterial({ color: 'rgb(242, 242, 242)', }); var material; for(let iX = 0; iX < w; iX++) { for(let iZ = 0; iZ < d; iZ++) { if((iX + iZ) % 2 === 0) { material = material1; } else { material = material2; } var box = generateBox(1, 0.1, 1, material); box.name = `box-${iX}-${iZ}`; box.position.set(iX, box.geometry.parameters.height / 2, iZ); room.add(box); } } // Walls for(let iX = 0; iX < w; iX++) { var wall = generateBox(1, 3, 0.1); wall.name = `wall-${iX}`; wall.position.set(iX, wall.geometry.parameters.height / 2, -0.45); room.add(wall); } for(let iZ = 0; iZ < d; iZ++) { var wall = generateBox(0.1, 3, 1); wall.name = `wall-${iZ}`; // Example here.. What I should use the instance of -0.45? I don't know why 0.45 shows me correct. wall.position.set(-0.45, wall.geometry.parameters.height / 2, iZ); room.add(wall); } return room; }