How To Change the Scene Setting's Gravity During Runtime

Hi, I am working on a project in which I need a method to change a dynamic rigid body’s gravity magnitude during runtime through script.

Basically I would like to know if there is some way to implement this:

this.entity.scene.gravity = (chosen value)

If anybody knows how to do this, I would love to know. Thank you for your help.

The gravity property is on the rigidbody system object. To change it do this:

app.systems.rigidbody.setGravity(0,0,0);

1 Like

Thank you very much! Is there a way to get the value of the Gravity property as well?

Perhaps something like:

app.system.rigidbody.getGravity ?

Thank you

Hmm, currently no way to get the current gravity easily. Though, of course, if you were the one to set it, then you know what it is. :smiley:

hey,
are static rigid bodies affected by gravity changes?
(It seems like there is no effect on them)

Gravity only affects dynamic objects.

1 Like