Tilt a ball along x&y axis in godot.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By THE HELIX
          Can anybody help me ;how i can move a ball front and back( along y axis), right and left( along x axis) in a 2D game just by tilting the device in the required direction and the code required for this ?
          Should i apply the code to Rigidbody2D or Sprite node?
          Should i use gyroscope or accelerometer in the movement?
          Please can you help me?

Hi, could you please reomve formatting from your question? you wrote it in code format.

p7f | 2019-01-04 11:44

Don't uses this. Unless it's gdscript, C#, or any other code.

Use normal text for questions like this. Please.

lavaduder | 2019-01-04 13:01

OK sorry. could u help me out with this problem.

THE HELIX | 2019-01-04 14:44

RigidBody or Sprite?

If you need collisions, use RigidBody2D, Area2D or KinematicBody2D. If you need physics engine to handle the movement use RigidBody2D. If you need it to be able to correct movement when it collides, use KinematicBody2D. Otherwise you are fine with Area2D.

Should i use gyroscope or accelerometer in the movement?

I think you should use accelerometer. Check sensor demo in assets library and start there. No much more help i can offer without something started. Perhaps someone already did this and can help you more.

p7f | 2019-01-04 15:18

Thanks for your help p7f.

THE HELIX | 2019-01-05 06:25

You are welcome. Does my comment solve your issue? Should i post it as an answer or would you prefer to remain unanswered to see if someone else helps?

p7f | 2019-01-05 14:15