我的三个js游戏崩溃
你好,我正在尝试在 Three js 上重新创建 Minecraft,我看到其他人正在那里。但是,即使我将 50 Block the crash game 放在我的视野中,也会立即显示它们 GitHub : https://github.com/ATLAbanana35/ThreeD-Pixel
我的立方体是这样的:
// Three.js cube
const geometry = new THREE.BoxGeometry();
const material = new THREE.MeshBasicMaterial({
color: 0xfffff,
transparent: true,
opacity: 0,
});
cube1 = new THREE.Mesh(geometry, material);
scene.add(cube1);
// Cannon.js cube
const shape = new CANNON.Box(new CANNON.Vec3(0.5, 0.5, 0.5));
const body = new CANNON.Body({ mass: 5 });
body.addShape(shape);
body.position.set(0, 5, 0);
world.addBody(body);
// Liaison entre les deux cubes
cube1.userData.physicsBody = body;