Change Gravity Of Character Movement Component


I am trying to Change the Gravity of Character Movement Component As Right now it only points in -Z, I tired Rotating the Character Actor but it still falls in -Z Axis, which upon looking at Source Code it seems the PhysFalling Function is the one that handles the gravity and falling state.

It has a local Gravity Variable that Sets the Gravity in Z axis (Gravity = FVector(0.0f, 0.0f, GetGravityZ())

I don’t want to Change the source code, well I can’t and I downloaded the engine from Launcher. Is there any other way I can do this by Extended my own Character Movement Component from the out of box one?

Sure, you will need to override it in C++, you can’t just blueprint override that.

I would suspect you’ll probably find many other things that would probably need to be changed if you are fully committed to changing gravity on everything, but that’s a good place to start.

1 Like

Yeah I am looking to override the C++ code, basically make my own Character Movement Component that derives from the base Character Movement Component.

The Problem is that the PhysFalling Function is too complicated, its about more than 300 lines. If I override it I will have to call it’s super function, sadly the base function set the gravity direction locally and calls newFallVelocity Function and there is no way I can change that in the derived class.

Yes, the Character subsystem in Unreal is fairly hard-coded, and not structured with further extension as the top concern. A friend had a similar problem when trying to implement a “round” planet – the Character really just wants “up” to be Z.

It may be that your best option is to copy-and-paste the Character and CharacterMovementComponent classes out of the engine and into your own MyCharacter and MyCharacterMovementComponent classes, and then go from there.

1 Like

Maybe this will help - a free “Ninja” gravity Plugin - that lets you set different gravity directions (to walk on walls, upside down).
So this knows how to do it - perhaps you can edit their settings?

1 Like

hmm so I just copy-paste the code into my own class, Obviously Change the Class Names to match the one I created. And It will work? Like no Conflicts on some struct names or something?

I am gonna try this right now.

Oh wow! I thought this project died long ago. Thanks If all else fails I will go with this one. No need to loose any more hair on Character Movement Component.


there is also the free “Dynamic Gravity” plugin
it gives you gravity volumes

There’s nothing at all preventing you from overriding ApplyDownwardForce() where the Gravity is set as you said, or NewFallVelocity().

Now, what I’d probably start with, is copying the entire PhysFalling into my own new custom Physics function, and mod it to handle the possible falling directions where gravity can go that it doesn’t now.

There is a MOVE_Custom mode, which calls PhysCustom(), with CustomMovementMode set to whatever uint8 you set it to. You can make your own enum, like EMovementMode, that defines various modes, if you’d like, then in PhysCustom() do a switch(CustomMovementMode) to handle your own gravity modes.

1 Like

You don’t have to, really. My approach here is to copy all the 300 lines of the “super” into derived and change only 2 lines i need.

The only thing you should keep in mind is that with updating of engine version you should check if super’s code was changed and modify your derived accordingly

Hi there,
There’s a free plugin found in the marketplace that might help you.
Directional & Planet Gravity in Code Plugins - UE Marketplace (

Thanks, I feel like I achieved something following your and jwatte’s advice, Now when I jump i.e when the character is not on ground it starts moving towards the -y Axis instead of -Z Axis.

The problem now is the Character Still does the Ground Check In Z axis even If I rotate the Character sideways it still checks for ground in Z. Which Function should I override to change the Ground Check Detection, I didn’t have much time to look at it but I did found some HitResult Variables but nothing much.