How to enable/disable Gravity for a Character?

I set gravity scale variable to 0 using blueprint inside my character, it’s doesn’t work but when I change it manually in the defaults tab it works !

any idea why is this happening ?

I have just discovered another thing, it seems that I’m able to change it only once by blueprints, I tried the following:

-set gravity to 0 when “g” key is pressed

-set gravity back to 1 when “g” is pressed again

and it worked only once (gravity on then off)

Hi,

What does your Blueprint look like and what is being affected by gravity, is it a player character or objects?

-W

it’s just a simple 3rd person character,

If I attach add relative location at the end of both sets, the first one effect should make the character floating around (no gravity) on other case should do nothing.

It’s worked once and my second attempt to disable/enable gravity will do nothing

Hey,

What happens if you use a FlipFlop node instead of a Branch, not sure if there’s something else going on in your Blueprint. But doing it like below, I was able to enable/disable gravity multiple times without an issue, does this help at all?

-W

Gravity is 0 → translate it up by 100,

I’m able to translate it but the gravity is still 1, even through debugging is 0 !
(not floating)

Hey,

I see what is happening now I think. When you set Gravity to 0 and then set the location of the character, it will instantly move the character to that position - since there is no gravity, the character doesn’t move and stands still in the position (if you were to move via input at all once in the position, the character would begin floating).

I suppose what you could do is after setting the position and gravity to 0, you could launch the character in any direction (I moved forward a bit) to give them the floating you are after (see below).

-W

Logically that’s true, but I tried it and still the same problem, it’s falling down like there’s a gravity.

To know what exactly I mean , try to manually set the gravity scale to 0 using defaults tab and set the location of the character somewhere in the air, U should notice that it’s falling slowly in the space !

By falling slowly in space do you mean this:

Gravity is still 0, the character is not actually falling or moving at all but is playing the falling animation. Is this what you are referring to and are looking to change?

-W

That’s weird :\

thank you so much for your time sir, I’m going to check my whole blueprint again

First of all, apoligies for replying to this old comment. At the moment I’m working on a game where the player movement is attached to a spline built road. However, the collision isn’t working. So for now the player is moving over the road while in the above posted animationclip. Is there a possibility to disable this?

Kind regards,
Bram

Where can i find gravity scale?

Very helpful picture thank you very much! but my character is rising up to fast… Its like his teleporting… Please help??