Guest User

Untitled

a guest
Jun 25th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. <div (click)="onClickCanvas($event)">
  2.  
  3. onClickCanvas(event) {
  4. let intersects;
  5. mouse['x'] = (event.clientX / window.innerWidth) * 2 - 1;
  6. mouse['y'] = - (event.clientY / window.innerHeight) * 2 + 1;
  7.  
  8. raycaster.setFromCamera(mouse, camera);
  9.  
  10. intersects = raycaster.intersectObjects(scene.children);
  11. if (intersects.length !== 0) console.log(intersects[0]['object'])
  12. }
  13.  
  14. camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000)
  15.  
  16. camera.position.x = 0;
  17. camera.position.y = 50;
  18. camera.position.z = 45;
Add Comment
Please, Sign In to add comment