Advertisement
Guest User

Untitled

a guest
Jun 12th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
BOO 0.72 KB | None | 0 0
  1. var waypoints = new Array();
  2. var myWaypoints:Transform;
  3.  
  4.  
  5. function Start(){
  6.    
  7.    // for each of the child objects of the waypoints object
  8.    for (var child : Transform in myWaypoints) {
  9.    
  10.       // add them to the waypoints array
  11.        waypoints.Add(child);
  12.    }    
  13.    
  14. }
  15.  
  16.  
  17.  
  18. function OnDrawGizmos () {
  19.         Gizmos.color = Color.red;
  20.    
  21.        for(var i : int = 0; i< waypoints.length;i++)
  22.        {    
  23.          var pos : Vector3 = waypoints[i].position;
  24.   // (icon image MUST be placed in Editor folder)
  25.        Gizmos.DrawIcon (waypoints[i].transform.position, "icon.tif");
  26.    
  27.             if(i>0){
  28.             var prev : Vector3 = waypoints[i-1].position;
  29.             Gizmos.DrawLine(prev,pos);
  30.             }
  31.        
  32.         }
  33.    
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement