How can I disable gravity in a level ? (or change the world gravity, not just an specific actor

Hi there.

I need to disable gravity in all objects in scene, doiong so object by object seems a bit strange, is there a way to modify the world gravity for a level?

Cheers and thanks!

There is a world setting tab in the Editor, But I assume by scene you mean a certain section of said level/map?

If section: I would use one or more bounding volumes to enable/disable gravity when the actor enters/leaves.

HTH

it’s not a section, I want to modify it for the whole level, like modifying the world gravity value, but I can’t find a way to do that.

If I want to do it with a volume, what do I have to do, with a blueprint in that volume? Because what I don’t want to do is to modify all actors one by one.

Cheers and thanks!

On the right side of the editor should be a tab called “World Settings”, Which is below “World Outliner”.
You can set the gravity there.

You will need to create a blueprint that has a collision volume set to overlap.
Then you use the “on overlap” event of that volume to disable the gravity(IIRC the node is called “set enable gravity”)

HTH

Hi ryan.

Thanks, I know the gravity value in the world tab, the problem is that I can’t find a way to modify it in runtime, like having three keys, one for 9.8, another for 0.0 and another for 4.3.

On the other hand what you mean is thta I use the overlap of the volume blueprint to modify every actor inside of it, am I right? That can work and I did not thougt it hehe

Thanks! If you know hos to change the gravity value at runtime tell me that too please :slight_smile:

Cheers!

After a quick search and check, I am unable to find a way to adjust gravity z at runtime.

There is a world settings class that can be accessed which has world gravity z, But it is marked as const(read only).
I don’t know if casting away the const will do anything, Will have to look deeper into that.

Yes, that is what I said (and have done before) :slight_smile:

The only workaround I know of is to disable the world gravity and apply a force to all dynamic actors to simulate the desired gravity.
The downside is that physics objects won’t be put to sleep as the force will keep them awake.
So there would probably be a large performance impact for having lots(>25?) of physics bodies kept awake like that.

HTH