Download

Strange behavior with CMC flying movement

Hello,
Recently I’ve been working on a wall-climbing system, and it has been going fairly well! I raycast for the wall, then switch the character to flying movement, and move along the wall that way. I noticed a really confusing error that I can’t seem to figure out: when the camera is at certain angles, the input will be ignored on Z axis for one direction.

To better explain, here is how I’m actually applying input:

X input controls Up/Down movement, Y input controls Left/Right, using the camera’s right vector as the world direction.

And here is a video of the buggy behavior. Both the input (1st and 3rd strings) and the camera’s right vector (2nd and 4th strings) are printed onto the screen here. They are printed twice because this movement input function is run on both MoveForward and MoveRight. You’ll notice that diagonal movement works as expected when holding left (Y axis of input -1) but when holding right the diagonals refuse to work (watch the strings): https://streamable.com/5nvefo

The camera angle seems to be contributing here, almost like the “add movement input” can experience some sort of gimbal lock? If I were to rotate the camera around 10 degrees from the video, then right diagonals start working but left stop.

There is nothing special I am doing that you can’t see. In this basic test I am just checking for a non-walkable wall with linetrace, then switching to flying mode. I am applying input like in the image. The branch has nothing to do with anything because it is simply for me to do different things based on which axis the player is holding. Any ideas?

This must be an error with the “add movement input” node. When directly setting the velocity of the player there is no issue:

I will need to make my own mini movement system for this, multiplying stuff by delta time with acceleration etc, which is annoying, but for now it’s a fix. I printed out the velocity that my original method would have been adding, and at no point does the Z velocity get messed up by my inputs. It’s identical to the alternative method.