Advertisement
Guest User

Untitled

a guest
Sep 17th, 2014
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1.  
  2. var Boxtest : GameObject;
  3.  
  4.  
  5.  
  6. function Update()
  7. {
  8. var fwd = transform.TransformDirection(Vector3.forward);
  9. var hit : RaycastHit;
  10.  
  11. if (Physics.Raycast(transform.position, fwd, hit))
  12. {
  13. if(hit.distance <= 5.0 && hit.collider.gameObject.tag == "Boxtest")
  14. {
  15.  
  16. Debug.Log ("your too close");
  17. }
  18.  
  19.  
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement