Unreal Z-axis independent gravity

Thats great!!! can you share the files or give some insights on how you were able to get directional gravity?

Hey. I plan on submitting a pull request to the Unreal Engine github page relatively soon when I am satisfied with my modifications (I haven’t worked on it since making my last post but now that someone is interested I’ll probably finish it up soon). My code currently breaks the CharacterMovementComponent’s (a player character) gravity right now though so I can’t do it just yet. It should be an easy fix though because I plan on simply modifying this to incorporate my new gravity functionality for a character too.

The gist of what needs to be is actually very simple, just a little time consuming (took me about a day to get a global gravity for all objects working and another day for CPU particles, still haven’t GPU and probably won’t if OP can’t help me). For global gravity, there are three floats throughout the project that represent z-gravity currently, DefaultGravityZ in PhysicsSettings.h and WorldGravityZ and GlobalGravityZ in WorldSettings.h. Changing these three to FVectors (and getting rid of the “Z” at the end of each name) and then going through the code and changing every reference to them to FVectors is almost all that needs to be . I also had to change and add a few functions to actually be able to change these at runtime that isn’t too hard. For CPU particles I added a new file/class called ParticleModuleAccelerationWorldGravity.h and then implemented the class in ParticleModules.cpp using the other modules as a guide. Currently, I have edited 24 files and added 1 for a total of 296 additions and 29 deletions. There will probably be significantly more when I am ready to make a pull request though.

Let me know if you have any questions.

Sweet! Oh, the possibilities!!

Any updates? would it appear in UE or as standalone plugin, free or not free?

UPDATE: I have submitted a pull request to Unreal Engine 4. Can be found here:

Feel free to clone it yourself because it will probably be a while before Unreal Engine actually incorporates it into its code.

Please direct all questions to me there from now on, as I will most likely never look at this forum post again.

404!! Noooooooooooooooooooo…

You need to have access to github private repo of the unreal source code…

Doh! Thanks. Feeling sheepish now.

Hey i was looking at your stuff and i was hoping you could point me in the right direction, i want to have a player character have dynamic gravity, but i’m very very new to ue4 and don’t really even know where to start, suggestions?

I’ve worked on this for my game - spherical voxel type game. What I found is that yaw becomes a relative only property. What I did was implement stuff derived at the Pawn level. I made a very cut down version of the character movement class, however I do support stepping, being floor aware, sliding, jumping, sending updates to the server and root animation. It is quite funny run jumping on a spherical work - thinking escape velocity.

Of course there is a performance penalty - basically needing to translate things between gravity relative and work relative co-ordinates.

It will be great when unreal supports it. I’m sure I have heaps of corner cases that have bugs.