# How to manipulate Impact Normal? Some vector math help needed

Hi,
With this setup, I am able to generate impulse in the opposite direction of the hit.
So basically if character is hit head on, this will move him backwards. And if he is hit from the back, it moves him forward and so on. Regardless of the characters current rotation in the world

Now what I am really after is a value from 0 to 359 (or 0 to 1) that indicates the direction of received hit. Clearly I should be able to produce that value from this Impact normal and then maybe some other set of vectors, but I am quite bad at vector math and very new to UE.

So what I want is, if character is hit head on (when character bounces backwards) a value of 0. If character is hit from behind, the value should be equal to 180. Hit from right should be equal to 90 and so on.

Any help with the math would be appreciated. I tried simple subtraction. Subtracting the characters world rotation from this normal gave really bizarre results.

So in simple terms I want from this normal a value that is not be in reference to the world, but to reference to the mesh/character current rotation.

Hi Y_o,

Try the “Rotation from XVector” node:

Something like this?

--

LookAtRotation is just 1 extra step from MakeRotFromX:

``````FRotator UKismetMathLibrary::FindLookAtRotation(const FVector& Start, const FVector& Target)
{
return MakeRotFromX(Target - Start);
}
``````

I used that and came up with something like this. It does seem to work and is actually consistent. Sometimes the values go to negative (inverted?). I wonder if there is a more elegant solution to get the hit direction in reference to the mesh without it being inverted sometimes. Basically now I get results where direct left hit results to value 270 or -90.

Those results seem exactly what I need. I found a one solution and I will test yours too.
So you get the hit direction from hit location. I get it from hit normal. I had no idea that there was this function to convert from world space to local space. That is what I wanted.
I will do more testing, but I now have 2 working solutions.

Thank you for your solution. I will have to set up a testing scene like yours, my current one is kind of bad.