I need help in creating a script that moves my GameObject (cube) from the initial place where it was. My cube persues and kicks a ball, when he do this he stays in the place where he kicks the ball, but I want to move him to it's original place. How to do this? Any help are welcome, thanks!
var initialPosition : Transform;
var Cube : Transform;
function Update () {
var distance = Cube.position - initialPosition;
if ( ( distance > initialPosition)) {
Cube.transform.position = initialPosition.transform.position;
}
}
↧