TeHArGiS10

Untitled

Jul 5th, 2014
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #pragma strict
  2.  
  3. var par : ParticleEmitter;
  4. var damage = 2;
  5.  
  6. function Update () {
  7.  
  8. var hit : RaycastHit;
  9. // Use Screen.height because many functions (like this one) start in the bottom left of the screen, while MousePosition starts in the top left
  10. var ray : Ray = Camera.main.ScreenPointToRay(Vector3(Input.mousePosition.x, Screen.height - Input.mousePosition.y,0));
  11.  
  12. if (Input.GetMouseButtonDown(0)) {
  13. if (Physics.Raycast (ray, hit, 100, kDefaultRaycastLayers)) {
  14.  
  15. Instantiate(par, hit.point, Quaternion.LookRotation(hit.normal));
  16.  
  17. var otherObj : GameObject = hit.collider.gameObject;
  18. }
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment