Hey guys. I’m completely new to unity and this is my first time using it.
I have a maze setup which I would like to roll a ball through.
After hours of searching all night I’ve been using this code which is the only one that finally made my ball move. However it flies off the screen and in all kinds of directions.
I read lots of posts pointing me to different places but I don’t really understand the coding and therefore the explanations are useless to me.
Just wondering if anyone could point out if there is a mistake, I have a deadline coming up and need this completed asap!
Thank you in advance guys!
function Update () {
var dir : Vector3 = Vector3.zero;
dir.x = -Input.acceleration.y*.5;
transform.position.x += dir.x;
dir.y = -Input.acceleration.x*.5;
transform.position.y += dir.y;
}