The following code is supposed to move object on z axis dependently of iPad’s movement forward and backward (not rotation) in landscape (home button is on right)
And problem is that object moves precise and smootly enought when device is being rotated on x axis, but when iPad is moved forward and backward (no rotation) object moves very disobedient and sometimes even not on movement direction.
function MoveObject()
{
var dir : Vector3 = Vector3.zero;
dir.z = Input.acceleration.x;
if (dir.sqrMagnitude > 1)
dir.Normalize();
dir *= Time.deltaTime;
transform.Translate (dir * speed);
}
Thanks for support!