/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* Ball.js :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: edbernar 0) { console.log("Distance du rayon à l'objet : ", intersects[0].distance); if (intersects[0].distance <= 0.5) { ball.rotation.y = Math.PI - ball.rotation.y } } } function bounceWallTBottom() { const origin = new THREE.Vector3(ball.position.x, ball.position.y, ball.position.z); const direction = new THREE.Vector3(ball.position.x, ball.position.y, ball.position.z + 1); direction.normalize(); const raycaster = new THREE.Raycaster(origin, direction); const objects = [ wallBottom ]; const intersects = raycaster.intersectObjects(objects); if (intersects.length > 0) { console.log("Distance du rayon à l'objet : ", intersects[0].distance); if (intersects[0].distance <= 0.5) { ball.rotation.y = Math.PI - ball.rotation.y; } } } export { Ball };