Download

How to Disable/lower gravity ingame using keybind?

Hello

i am new to using the Unreal Engine 4 and am currently wondering if there is a way, using Blueprints, to disable or to lower gravity ingame using a keybindng?

Thank you

Maybe this question on AnswerHub will help you?

https://answers.unrealengine.com/questions/34170/gravity-scale-variable-problem.html

There i sthis tutorial is well, not sure if it covers your question.

https://www.youtube.com/watch?v=EZ9klcc6HLk

[QUOTE=TheSpaceMan;165220]
Maybe this question on AnswerHub will help you?

https://answers.unrealengine.com/questions/34170/gravity-scale-variable-problem.html

There i sthis tutorial is well, not sure if it covers your question.
https://youtube.com/watch?v=EZ9klcc6HLk[/QUOTE]

The first link might help me, i’ll have a try what is mentioned on those blueprints if i can figure some of them out.
That second link was just a tutorial on how to set or disable the world settings for gravity (which is something i already know how to do).

What I am aiming to do is create a game that relies on the ability to change gravity using the keyboard ingame.

I have just read through the first link which provides blueprints but unfortunately they were not very helpful as some of the blueprint nodes they use i am unable to locate such as gravity scale.

Does Unreal Engine 4 contain a native blueprint gravity node, or does this particular node have to be created for use in the blueprints?

As far as I know you can’t change gravity on the fly

How many things in the world would be affected? Actors or simply static meshes?

For the moment the only thing i would like to have affected by gravity on the fly ingame is the character.

Oh that’s easy then! Gravity is “just” a force accelerating everything downwards. Basically, just have an EventTick node and use thee “Add Force” node to apply a vector force downwards on your character. You can make this vector change dynamically through other controls to change the “gravity”.

To do it really properly, use the delta time pin and multiply you vector by that. Your vector will have to be much smaller but that means that the force will be proportional to the amount of time the tick/frame took

Would you be able to produce an example image of the blueprint as I have searched the avaliable variable and function nodes on my blueprint editor and i cannot find the ‘Add Force’ node.

Even easier, if you’re only talking about a CHARACTER, you can Get the Character Movement Component, drag off of it, and Set the “Gravity Scale” variable to adjust how much gravity affects the given character.

Ah i didn’t know that draging the node linking line brings a list of nodes that is compatible, i have finally found the gravity scale and will try the gravity blueprint from the first reply.
Thanks

If you want to add the force, you drag it out from a component pin, like a mesh component.

If you use the “palette” on the right (which seems disabled by default on 4.5, find it under the windows menu - this is in blueprint editor btw) you can search and every possible function will come up, not just those that are context specific

I have managed to create this blueprint which has allowed me to disable and then re-enable gravity ingame for my character:
53c0a208be8b79605562538fffe9051e.png

Thank you everyone

Adding to rodstone’s post ^^ you can also un-check the “Context Sensitive” checkbox from the menu that pops up when you right click / drag off a wire as well.

Wish this was better documented, there are a lot of people using UE4 that do not know that dragging off of certain nodes shows a different result, it causes a lot of confusion. :slight_smile:

Yeah this is exactly why i was having difficulty finding any force or gravity nodes, thanks again everyone