How to use Input.get_accelerometer()

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Hinsbart
:warning: Old Version Published before Godot 3 was released.

What does the returned Vector3 of Input.get_accelerometer mean?
The values seem to be around 0 and 9.8 so I guess it’s something about force/gravity.

Can I simply treat this like a rotation, for tilt-controls?

:bust_in_silhouette: Reply From: volzhs

Yes, you can do like this.
It’s an amount of how much lean with direction.

func _process(delta):
    if Input.get_accelerometer().x < 0:
        move_left()
    else:
        move_right()