# How to get direction/rotation along surface?

Hello, so I want to create a wallrun system via linetrace and I currently have two linetraces shooting out from the left and right of the character and when it detects a wall I then try and take the surface normal and make the actor rotate from that, but the problem is the actor isnt rotating along the wall, rather away from it.

I’m not really sure how I would go about getting the Direction/Rotation along the surface of the linetrace hit.

Any help would be appreciated thank you!

Hi , it seems like everyone is struggling with this and no answers were found , but i was thinking about that idea since we can’t get the rotation of a surface with any kind of trace what about generating it ourselves , so my idea is

Do tow line traces out of the left side as an example , and they are both locked to the player rotation
we point the first line at an angel behind the player , and point the second line at an angel ahead of the player
then we get the vector between line 1 hit and line 2 hit , and set the forward rotation of the player to that vector we just made…

i’m not sure if this is a true method or even logically possible , the one thing i’m sure of is that the character will not leave the wall since we set his rotation to that new vector , so he would always be rotating and the line trace would always redirect with the player rotation to that new vector.

if someone is really advanced and know if this would fail or work , it would be nice if you cleared the water for the internet.

Hi! thanks for the response I’ve been playing around with the wallride mechanic since and I have gotten around to a result that I am happy with.

Instead of a line trace I used a single capsule trace that originates from the middle of the character, this is so it can get the impact normal of surfaces that line traces arent accurate enough to detect.

I then took that impact normal and added a negative impulse to make sure the character wouldnt just fly off the surface (this would happen with a cylinder for example)

After that I just launch the character based on its forward vector which enables it to wallride at the velocity it starts the wallride on

I think the most important part of the mechanic is the capsule trace as the linetrace is unable to detect the more complex objects that I was willing to wallride on.

Also for the rotation of the character I took the impact normal and added/subtracted 90 degrees depending on which side I started the wallride

i know it is an old post, but let me answer it so the search algorithm make other benefit.

This is how i do it the easy way.

1. get the z direction or the direction you are rotate around using (Get control rotation) (this is original point)
2. find the targeted location your object is rotating toward (Find look at rotation) (this is the end point)
3. apply subtract float for (target - original), if bigger than zero then your object rotating right, and vice versa
4. you can use logic to end up with 2 booleans (rotating right and rotating left)

these 4 steps are applied to topdown character , where the rotation of the character happens by mouse. Always the mouse click represent the targeted point to rotate to.

i hope these steps will make the process of making your own blueprint easier