Questions I just cannot answer

Okay guys, Im sure you will find this easy.
My sub cruises along at this speed:

function Update() {
    transform.Translate(0, 0 * Time.deltaTime, 1.5);
}

And when it hits something, I want to destroy the sub,

var subDead : Transform; 
function OnCollisionEnter () 
{ 
   Destroy (gameObject); 
   Instantiate (subDead, transform.position, transform.rotation); 
}

Basicly Im trying to use the second script to either destroy (or for the benefit of my learning curve, disable) the first script

Can anyone see where Im going wrong?Thanks
AC

It would help if you told us what happens, rather than “it doesn’t work.” Does ths sub move wrong? Does it pass through things rather than collide?

This piece of math looks suspicious: 0 * Time.deltaTime

If it passes through things, maybe your sub or the other objects don’t have a rigidbody component on them?

As mentioned in the other thread, change that to (0, 0, 1.5 * Time.deltaTime).

I’m wondering why you want to destroy the first script? Once you’ve destroyed gameObject, it’s not going to be moving along its Z axis any more (since it doesn’t exist), and subDead doesn’t inherit the first script, so it won’t move when you’ve instantiated it (unless you specifically add a force to it). Seems to me that part is fine the way it is.

–Eric