Set rotation actor with impact normal

Hello,

I would like to change the rotation of an actor (here a pawn) depending on the impact normal from line trace. It works for a climb but not for a descent because the impact normal is always positive. Someone has an idea to fix that ?

ok, I found a solution…

Could you share your solution please? I’m having the same problem!

Of course ! Just check if the value of x from the impact point is positive or negative. My blueprint if it can help :

Line Trace

Event graph

1 Like

There is a slightly cleaner way to solve this issue. My answer is a few years late, but found this on a Google search, so leaving a response for people finding this in the future.

Grab the impact normal from your hit result and pass it as the forward vector on a MakeRotationFromAxis node (leave the other two vectors at zero. Apply the resulting rotation to whichever actor you want to match the surface of your hit object.

2 Likes

James, could you elaborate on this? I gave it a try, but I’m having trouble. I’m trying to get my character to rotate toward the impact point of a line trace (Z-axis only).

You seem to be making a rotator from the impact normal, then making it a vector only to make a rotator again. I’m working on a slightly similar problem but it’s on the X axis of a wall.
I’m turning my character to face the same direction as the back-end of the wall he’s about to vault.

Now I don’t know if you would need to invert the vector like I did in your case. But my works okay so far.

2 Likes