In the physics behavior, gravity direction points to the bottom of the page. Would it be possible to update this behavior and ad a function allowing the gravity direction and stength to change according device inclination ?
I'm sure that's a behavior many people would love to have.
Develop games in your browser. Powerful, performant & highly capable.
You can already do it yourself.
Set the gravity to 0, and every tick add a force on your object.
The angle/direction of this force depends on what you want, and this is a way to apply gravity in the direction you want.
It requires a bit of math I guess, to transform the orientation into an angle for the force, but it is doable.
Oh, Thanks Kyatric. But that's why I was longing for a great all-in-one behavior, because I'm really not used to maths and I don't know how to grab information from the tablet gyroscope.
Just to add:
the force has to be multiplied by object.physics.mass too
0.2 * object.physics.mass is the rough equivalent to the default gravity (which is a value of 10 for some reason)
Thanks, Keepee. And how do I get the inclination from the device sensors ?