Hey there, I am experimenting with the tilting controls on mobile and came across with a problem.
The PlayTest level is below. When the ball is rolling on the ground everything works fine, even while jumping. The issue comes when it touches a wall. The movement gets sloppy and the calibration changes for some reason.
As an example, if the ball touches a wall that is facing the camera, tilting the device forward will move the ball backwards.
The code I am using is pretty default, as I copied its core:
(JavaScript)
function Update ()
{
var dir : Vector3 = Vector3.zero;
dir*= Time.deltaTime;
dir.x = 0.25*Input.acceleration.x;
dir.z = 0.25*Input.acceleration.y;
transform.Translate(dir.x, 0, dir.z);
}
Any idea on why this happens /how to fix this?