Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Boxtest : GameObject;
- function Update()
- {
- var fwd = transform.TransformDirection(Vector3.forward);
- var hit : RaycastHit;
- if (Physics.Raycast(transform.position, fwd, hit))
- {
- if(hit.distance <= 5.0 && hit.collider.gameObject.tag == "Boxtest")
- {
- Debug.Log ("your too close");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement