i want a ballon to move inside the camera using the accelerometer on the x axis.
i can’t seen to find anything on that any help?
To move your player (or object) using accelerometer try this Input.Acceleration .
you can use this code…
void Update()
{
float speed = 10.0F;
Vector3 dir = Vector3.zero;
dir.x = Input.acceleration.x; // for XZ plane ,as in typical top-down configuration
dir.z = Input.acceleration.y;
if (dir.sqrMagnitude > 1)
{
dir.Normalize();
}
//move 10 meters per second instead of 10 meters per frame
dir *= Time.deltaTime;
transform.Translate(dir * speed);
// do your rest of the stuff here
}