Using tilt sensor to simulate gravity
-
I want to add a little gimick to my app.
I'm trying to put a bar at the top of my gui and within this bar there is a image of a ball.
Depending on how you tilt your phone the image of the ball should either go to the right or left.
To give you a better understanding of what I mean, here some pictures:
I've found this but still could not figure out how to do it.
Does anyone have an idea how to approach such idea.
Is it even possible?
Appreciate any help! -
I want to add a little gimick to my app.
I'm trying to put a bar at the top of my gui and within this bar there is a image of a ball.
Depending on how you tilt your phone the image of the ball should either go to the right or left.
To give you a better understanding of what I mean, here some pictures:
I've found this but still could not figure out how to do it.
Does anyone have an idea how to approach such idea.
Is it even possible?
Appreciate any help!Check out https://doc.qt.io/qt-6/qtiltreading.html and the docs about sensors in general.
The link shows the essential: you can read the current tilt. But that is the trivial part. The hard part is programmind the dynamics.