I need to create some way points to implement an AI for a racing game…I have created some empty game objects and assigned the following Script. to the game objects …It should show some line between the objects and the objects should be marked as sphere but I’m getting nothing .Can anybody help ?
var path : Array;
var rayColor : Color = Color.red;
function OnDrawGizmos(){
Gizmos.color = rayColor;
var path_objs : Array = transform.GetComponentsInChildren(Transform);
path = new Array();
for (var path_obj : Transform in path_objs){
if (path_obj != transform)
path [path.length] = path_obj;
}
for (var i : int = 0; i < path.length; i++){
var pos : Vector3 = path*.position;*
if (i>0){
var prev = path[i-1].position;
Gizmos.DrawLine(prev,pos);
Gizmos.DrawWireSphere(pos,10);
}
}
}
#pragma strict
var path : Component[];
var rayColor : Color = Color.red;
function Start(){
path = GetComponentsInChildren(Transform);
}
function OnDrawGizmos(){
Gizmos.color = rayColor;
for (var i : int = 0; i < path.length; i++){
var pos : Vector3 = path*.transform.position;*
-
if (i>0){*
-
var prev = path[i-1].transform.position;*
-
Gizmos.DrawLine(prev,pos);*
-
Gizmos.DrawWireSphere(pos,10);*
-
}*
-
}*
}