Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
init() {
/*----- CREATE WALL -----*/
const wallBody = new CANNON.Body({ mass: 0 });
wallBody.addShape(this.fixedCubeShape);
const wallMesh = new THREE.Mesh(this.fixedCubeGeometry, this.material);
/*----- SET SPAWN POSITION -----*/
wallMesh.position.set(this.x, this.y, this.z);
wallBody.position.set(this.x, this.y, this.z);
scene.add(wallMesh);
world.add(wallBody);
this.wallMesh = wallMesh;
this.wallBody = wallBody;
}
}
init() {
/*----- CREATE FIXED CUBE -----*/
const fixedCubeBody = new CANNON.Body({ mass: 0 });
fixedCubeBody.addShape(this.fixedCubeShape);
const fixedCubeMesh = new THREE.Mesh(this.fixedCubeGeometry, this.material);
/*----- SETS SPAWN POSITION -----*/
fixedCubeMesh.position.set(this.x, this.y, this.z);
fixedCubeBody.position.set(fixedCubeMesh.position.x, fixedCubeMesh.position.y, fixedCubeMesh.position.z);
scene.add(fixedCubeMesh);
world.add(fixedCubeBody);
this.fixedCubeMesh = fixedCubeMesh;
this.fixedCubeBody = fixedCubeBody;
}
}
init() {
/*----- CREATE PLAYER -----*/
const cubeBox = new CANNON.Body({ mass: 0 });
cubeBox.addShape(this.fixedCubeShape)
const cubeMesh = new THREE.Mesh(this.fixedCubeGeometry, this.material);
/*----- SETS SPAWN POSITION -----*/
cubeMesh.position.set(this.x, this.y, this.z);
cubeBox.position.set(cubeMesh.position.x, cubeMesh.position.y, cubeMesh.position.z);
scene.add(cubeMesh)
world.add(cubeBox)
this.cubeMesh = cubeMesh;
this.cubeBox = cubeBox;
}