Ok, so I have a game where coins are created and fall down, if you click on them they disappear. But, if one reaches the line at the bottom, it’s GameOver. So I can correctly test for a coin hitting the line, but after that I want the coin to go to 0,0,0 so it can play a cool animation that I have yet to do. So, I created the script below and the position = Lerp() is not working, the coin just stays where it is. I don’t get any errors, it just stays where it is. Hope you can help! Thanks!
#pragma strict
var CoinCreater : CoinCreater;
function Start () {
}
function Update () {
}
function OnTriggerEnter(object : Collider){
if(object.gameObject.tag == "Coin"){
var CoinFall : CoinFall = object.GetComponent("CoinFall");
CoinFall.enabled = false;
CoinCreater.scriptEnabled = false;
CoinCreater.enabled = false;
var extraCoins : GameObject[];
object.gameObject.tag = "GameoverCoin";
extraCoins = GameObject.FindGameObjectsWithTag("Coin");
for(var currentCoin in extraCoins){
Destroy(currentCoin,0.0);
}
var rate : float = 0.05;
var destination : Vector3 = new Vector3(0, 0, 0);
var position : Vector3 = object.gameObject.transform.position;
position = Vector3.Lerp(position, destination, rate * Time.deltaTime);
}
}