Alright, so I’m programming a custom character script, so your character can go up and down walls, and whatever terrain. And it works for the most part, but there’s a small issue.
I keep the character’s current Y rotation in a variable, and this is typically correct on flat ground, but lets say you’re on a wall. So on flat ground it points on the -Z axis. But lets say you were on a 90 degree wall to the side, it points in the -Z axis and stays aligned with the ground by tilting the player 90 degrees on the X axis, but if you were on a wall that was behind the player, it would have to be aligned with the ground by tilting the player 90 degrees on the Z axis, so if you went between these 2 walls, your player would turn in an undesirable way.
Tl;dr: The character is changing direction when the wall’s rotation changes.
I’ve tried tons of things. Comparing specific cross products, specific dot products, seeing how the character’s global Y axis rotation changes, but none if it gives a really consistent result. Could you help?