How do I add 3D surface-based Gravity, like in Run 3

I’m sure a lot of you played Run 3 on coolmath games as a kid, it’s basically a moving platformer where you play inside a polygonal tunnel, and if you touch a different face of the tunnel, your gravity becomes that direction.

How do I do this in UE5, so that if the player touches any surface, the gravity changes to be perpendicular to that surface.
This means that if the player were to touch a wall, the gravity would turn 90 degrees in that direction, if the player touches the ceiling, the gravity would flip, etc.

I only need this to work for 6 faces since the entire level will be made of cubes. This means the gravity will only need to flip to +X, -X, +Y, -Y, +Z, -Z.

Thank you in advance!

Hey @Jazz8942! Welcome to the forums!

The go-to used to be something called “Ninja Character Plugin” which won support by the Epic MegaGrants Program back in the day. However, it is not going to be updated for 5.5 or later, and is not on Fab. On the store page it says " The plugin won’t be updated for Unreal Engine 5.5 or later (use Epic’s CharacterMovementComponent with custom gravity, or use Epic’s Mover 2.0 plugin)."

Assuming you’re using 5.4, try this tutorial!

Thanks man! I’ll give it a try.

There is also the " Directional & Planet Gravity" plugin, maybe this gets an update too.

https://www.fab.com/de/listings/5e47876e-8dc9-457f-870b-77ba2a7e65da

for run 3 style the clean way is volumes per tunnel section, not per surface trace. each box sets gravity to its face normal and the character aligns to it, so walking onto a wall just changes which volume you are in.
on 5.4 plus you can call SetGravityDirection on the movement component and the floor check follows teh new down, on older versions you have to fake it with add force and manual rotation which always drifts.
you can also try Gravity & Ballistics Toolkit, a gravity plugin for Unreal Engine that covers tunnel sections with box volumes and keeps the character aligned through face changes: Gravity & Ballistics Toolkit — Planet Gravity, Zero-G & Arc Prediction | Fab