Can I alter world gravity through scripting?

Soooo…

I want to be able to alter my level’s “World Gravity” at runtime. Is there a way to do this through scripting? I know I can SET my Default Gravity Z in the project settings…and even override that in the World Settings…but is there a way I can alter it at runtime? As an example, I’d like to have “normal” gravity and then once my player overlaps a trigger volume I alter the gravity such that all physics objects float away.

A similar question was asked so many times that Epic Games should really consider adding the possibility to change gravity via blueprints =)

Anyway, you can use a workaround: set physics objects’ Simulate Gravity to False and Add Impulse once (if you just want them to behave like in zero gravity and just float away a bit), or Add Force on Tick (if you want to simulate the gravity angle change).

Hey! This is so goood! You really helped me to implement an independent “gravity 0” for every independent object.

But now I would like to drag or kind of stop the displacement in space of these objects after a given time, is that possible??

Thanks a lot!

Just add a timer to your object’s BP and counter the impulse by applying the exact reverse value of it to cancel out any movement.

Its not rocket science (but it is!)…