Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. function Update () {
  2.  
  3. if(Input.GetButtonDown("Fire1"))
  4. {
  5. var ray : Ray = GameObject.Find("MainCamera").camera.ScreenPointToRay(Input.mousePosition);
  6. var hit : RaycastHit;
  7.  
  8. if(Physics.Raycast(ray, hit))
  9. Debug.Log(" " + hit.transform.gameObject.name);
  10. }
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement