Advertisement
Guest User

Untitled

a guest
Jul 25th, 2016
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. hits = Physics.SphereCastAll (transform.position,3f,transform.up,0,-1);
  2.  
  3. for (int i = 0; i < hits.Length;i++) {
  4.  
  5. RaycastHit currHit = hits[i];
  6. if (currHit.transform.GetComponent<NodeMaterial> () != null) {
  7.  
  8. currHit.transform.GetComponent<NodeMaterial> ().Cover();
  9.  
  10. if (Physics.Raycast (currHit.transform.position,transform.position,Vector3.Distance(currHit.transform.position,transform.position), layMask))
  11. {
  12. Debug.DrawLine (transform.position,currHit.transform.position, Color.red,30f);
  13. currHit.transform.GetComponent<NodeMaterial> ().UnCover();
  14. }
  15.  
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement