Download

Getting rotation from a trace

Hi, i’m trying to create a third person enemy auto target: Basically i want to rotate the player towards an enemy i’m roughly pointing at (with a certain distance from the crosshair) when i cast a skill.

To do so i decided to use the trace function to cast a sphere from the camera, this sphere will eventually hit an enemy and generate an hit point.
After the hit point is generated, the blueprint will generate another trace (This time a line one) starting from the player and pointing to the hit point of the previous trace.

Now the only thing left to do is to rotate the player in the same direction of the line trace. And here comes the problem: i don’t know how to do that…

The first thing that comes up in my mind is to use the SetActorRotation function, but there is no thing such as rotation on the trace outputs.

I ask forgiveness in advice for my poor english and explaining ability, i’ll attach a screen of the blueprint to make things clearer.