Gravity direction

0 favourites
  • 5 posts
From the Asset Store
Hand-animated Sprite Base for isometric game/animation development
  • Hey there,

    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.

    L

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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 ?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)