the missile doesnt move or look at the target, it just sits there and then explodes after 10 seconds
heres the script:
var target : Transform;
var explosion : GameObject;
var activated = 1;
function Start () {
Invoke("Destroy",10);
}
function Update () {
if(activated == 1){
transform.Translate(Vector3.forwards * Time.deltaTime * 20);
transform.LookAt(target);
}
if(activated == 1){
if(Vector3.distance(transform.position,target.position)<= 10){
activated = 0;
}
}
}
function OnCollisionEnter () {
Destroy();
}
function Destroy () {
Instantiate(explosion,transform.position,transform.rotation);
Destroy(gameObject);
}