Advertisement
LittleAngel

Untitled

Jul 30th, 2013
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class tester : MonoBehaviour {
  5.  
  6. public LayerMask la;
  7.  
  8. // Update is called once per frame
  9. void Update () {
  10. Vector3 fwd = Camera.main.transform.TransformDirection(Vector3.forward);
  11. RaycastHit hit;
  12. if(Physics.Raycast(Camera.main.transform.position,fwd,out hit,10,la ))
  13. {
  14. Debug.DrawLine(Camera.main.transform.position, hit.point);
  15. print ("something in front" + hit.transform.name);
  16. }
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement