Hello community! I wanted to control a rigidbody by using accelerometer on android, i printed something like this:
function Update() {
if((Input.acceleration.x) > 0)
{
rigidbody.AddForce(Input.acceleration.x, 0, 0);
}
else if((Input.acceleration.x) < 0)
{
rigidbody.AddForce(Input.acceleration.x, 0, 0);
}
else
{
rigidbody.AddForce(Input.acceleration.x, 0, 0);
}
}
But nothing worked. So, i hope that Input.accelereation.x is integer, since i can’t find any information about this function ^^.
Hope for a fast answer =) Thx
Look, imagine that rigidbody located at a big hill, then it will roll down, and while it is, you can move rigidbody with accelerometer, to the left and right.