Hello,
I am making a school project where I use devices motion sensor for moving an object on the screen.
I have a sphere and cube(as surface). On the sphere I added script for using Input.acceleration for moving it. All good till I add rigidbody with gravity force on it. Then the sphere falls to the surface, but it moves with problems. Like it would get stuck in the cube.
This is the script that I am using:
var speed = 10.0;
function Update () {
var dir : Vector3 = Vector3.zero;
dir.x = -Input.acceleration.y;
dir.z = Input.acceleration.x;
if (dir.sqrMagnitude > 1)
dir.Normalize();
dir *= Time.deltaTime;
transform.Translate (dir * speed);
}
And I am developing for Android 2.1
Please some help. I am really lost. Checked already all manual and articles on Unity Wiki and here.
(sorry if this is a double)