Unreal Z-axis independent gravity

I broke everything lol. Looking like for now it might be easier to write a new movement component from scratch to replace charactermovementcomponent rather than modifying it. Also, the navmesh system will need to be modified to use the gravity direction.

]
Video 2 - GPU particle support

This update shows that it is possible to support dynamic gravity with GPU particles too, this involves updating shaders and code that works on the GPU.
[/QUOTE]

Hello. I know this thread is over a year old but I was hoping you could help me. I am doing the same thing you have here and have gotten everything except dynamic GPU particles. I was hoping you could give me some advice or just straight up tell me how you did it because I have never used usf shaders before and I am pretty stuck.

I’ve narrowed down where I need to make changes to 3 or 4 files: ParticleGpuSimulation.cpp, ParticleModuleTypeDataGpu.h, ParticleInjectionShader.usf, and ParticleSimulationShader.usf (and probably also the particle module I made). I understand if you can’t help me because of your work or something like that but I’m really hoping you can help me with this. If not no hard feelings though.

P.S. I also commented this on the video in hopes of getting your attention faster :stuck_out_tongue:

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.