Hi
I want to destroy the object if it hits another object or it travel 8 to on the VectorX
I have this as below but it does not work
var Speed : float;
var Position : float;
function Awake (){
Position = transform.position.x;
print(Position);
}
function Update () {
transform.Translate(Speed * Time.deltaTime,0,0);
if (Position == Position + 8 ) {
Destroy(gameObject);
}
}
function OnTriggerEnter (col : Collider ) {
Destroy(gameObject);
}