Find Direction / Rotation between 2 locations

So I am trying to find the direction in witch a building is being hit to determine where to start the fire effects (If the damage comes from the North side then the fire will start on the North side of the building). I have the building location Vector_0 and the hit location Vector_1. I want to turn that into one of 4 outcomes. NSEW, up down left right, or 0 1 2 3. I’ve tried dot products and look at rotation and conversions and I can’t seem to get the math right. If I could get a 0 to 1 number where 0 is X forward , 180 to -180 , or 0 to 360 I could figure out the rest. Any help would be welcome.

Hi man,
the direction from point A ,to point B, is just ( LocationB - locationA ).
Lets say Your A is in 5,5,5 and B is in 10,10,10, the direction 10-5 ,10-5, 10-5 = Direction= 5,5,5
(you can normalize too the vector to obtain the same inclination but with 1 of lengt)

then there are some ways to detect if the direction you have is NortSudWestEst…
You can check manually ,
or use the dot product with the forward vector ,

1 Like

Works good thanks for the advice Est_engine.

Hear is the Blueprint code I used.

This got the rotation

This found the facing direction.

This works great with a square object, but when its an odd shape it does not always work out. So I made a variable called center with the show 3d widget option so I can change where the get actor location on Self is. Also I Made 3 d2 vectors to hold the variables for the floats that are checked to find the direction so they can be changed if needed. When I added in to account the Actor rotation I had to adjust some of the numbers too.