Hello the problem im having is with my enemies (that ive made in to a prefab) is that i can only get one to shoot from its spawn point the other enemy is shooting from the first enemy in other words when i have 2 enemies on the screen they are both shooting from the first enemies spawnpoint (dualshoot) this is the code im using on the ai.
also instead of using waypoints does anyone know how i get the ai to just flying forward.
var waypoint : Transform[];
var speed : float = 150;
private var currentWaypoint : int;
var prefabRaket:Transform;
var x : int;
var shootForce: float;
function Update () {
if(currentWaypoint < waypoint.length){
var target : Vector3 = waypoint[currentWaypoint].position;
var moveDirection : Vector3 = target - transform.position;
var velocity = rigidbody.velocity;
if(moveDirection.magnitude < 5){
currentWaypoint++;
}
else{
velocity = moveDirection.normalized * speed;
}
}
rigidbody.velocity = velocity;
if(x==200) {
var instanceRaket = Instantiate(prefabRaket, GameObject.Find("jas/spawn3").transform.position, transform.rotation );
instanceRaket.rigidbody.AddForce(transform.forward * -1 * shootForce);
x=0;
}
x++;
}