Get gravity in blueprint

Hello,

I want to get at runtime the gravity value set in project’s settings (default 980).

So far, all I managed to get was the overrriden value set in the level settings (World settings -> Global Gravity Z). But if it’s not overriden, all I get is ZERO.

As of why, I’m making a component that needs gravity value, and I’d like it to be reusable accros differents projects.

Thanks in advance !

Nobody knows ? Is it at least possible in C++ ?

Thanks for your reply BaronPain.

Sadly, the solution shown on your link only apply if the “global” gravity is overriden in a level, if not, any call to the mentionned “Global Gravity Z” node will simply return 0.

Using C++ you can get the gravity setting in the project’s physics settings:

UPhysicsSettings::Get()->DefaultGravityZ

This should get you the value you need without having to override gravity in the level settings.

I was unable to locate a method for getting the default gravity through blueprints. You can always write your own blueprint callable function in C++ though.