Vector Rotation Maths advice - Rotating capsule with regards to a surface normal

Hello all, hope you’re well!

I’m working on a project that centers around wall riding, and have so far set up a rudimentary blueprint to handle this. My aim is for the player to leap onto a wall, and have them ride continuously on that wall in a direction that matches the surface direction, whether that surface be curved or flat. I also want the player to be able to look around in all directions, and still remain attached to/riding that surface.

To achieve this so far, I’ve put together the following blueprint. A collision capsule named “Wall Detection” has been added to the player character, and that capsule is used to start a line trace, the end of the line trace should turn to match the capsule’s rotation. That line trace returns the normal of the surface, which is used to figure out the direction the player should continuously ride in, and is also used to rotate the capsule to match the wall ride direction.

However, an issue is arising with this implementation - I’ve added a debug arrow to the capsule to demonstrate which direction the capsule is facing. When the player is riding the wall, the capsule, and by extension this debug arrow, rotates on the Y axis to face the ground. Everything else works well, the capsule rotates as expected to match the wall surface on the Z and X axes, but I would like it to face ahead on the Y axis.

Could I please get some advice on how to rectify this? Everything I’ve tried so far to the Y axis to get it to face ahead has broken the Z and X axes rotations, leaving them not restricted to the wall direction.

Please feel free to ask any questions you need to clarify anything - I’m new to blueprints, and vectors, and asking questions on the forums! Any help in fixing my vector/rotation maths, or in recommending alternate methods to get my overall aims to work, would be massively appreciated.

Thank you!

Fixed the issue, I was just overcomplicating it!

Now I’m just grabbing the vector of the wall run direction (which is perpendicular to the impact normal form the line trace), normalising it, getting a rotation from that vector, and changing the capsule’s rotation to match that.

Marking as resolved, cheers!

Hey there, sorry to resurrect an old thread, but what’s in your “Find Run Direction and Side” in your screenshot there? Just wondering how you found the wall run direction. Thanks!