Quantcast
Channel: Questions in topic: "moveto"
Viewing all articles
Browse latest Browse all 116

How to move GameObject to an initial Point?

$
0
0
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; } }

Viewing all articles
Browse latest Browse all 116

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>