Camera-dependent inverted movement when walking on ceilings (custom gravity, UE5)

Waabs
Fri, 12 Dec 2025 10:51:30 +0000
Programming & Scripting

Hello everyone,

I’ve been working for some time on a system where a character can walk on any surface.
The system works well overall, and gravity is correctly computed using line traces.

I’m currently facing a major issue when the character is walking on the ceiling, i.e. when gravity is (X=0, Y=0, Z=1).

On the attached video, I’m only pressing the forward movement input. However, when gravity is set to (0,0,1), the behavior depends on the camera orientation:

If the camera is facing the X axis, movement works as expected.

If the camera is facing the Y axis, the controls become completely inverted.

This is not an input issue, but appears to be a reference frame / rotation problem caused by how movement direction is computed relative to gravity and camera orientation.

Technical context:

Unreal Engine 5.6

Blueprint only

Movement is based on Add Movement Input

I compute a custom rotation using a function called “Get Gravity World Rotation”, which is applied after Get Control Rotation, before being used to drive movement.

All relevant Blueprints are shown in links below

Question:
What is the correct way to compute a movement direction that remains consistent regardless of camera orientation when gravity is inverted?
More specifically, how should the movement basis (forward/right vectors) be reconstructed when walking on ceilings, to avoid axis inversion issues?

Get Gravity World Rotation Blueprint
Movement Input with Gravity

Video :

2 posts - 2 participants