Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div (click)="onClickCanvas($event)">
- onClickCanvas(event) {
- let intersects;
- mouse['x'] = (event.clientX / window.innerWidth) * 2 - 1;
- mouse['y'] = - (event.clientY / window.innerHeight) * 2 + 1;
- raycaster.setFromCamera(mouse, camera);
- intersects = raycaster.intersectObjects(scene.children);
- if (intersects.length !== 0) console.log(intersects[0]['object'])
- }
- camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000)
- camera.position.x = 0;
- camera.position.y = 50;
- camera.position.z = 45;
Add Comment
Please, Sign In to add comment