Angle of wall (degrees) in relation to player?

If I’m running towards a wall, I want to do a trace and find out the angle of the wall in relation to the player.

I’m mainly concerned with flat surfaces but it should work on other surfaces that might have detail, or say a fence, so I wonder if I need to do 2 traces and compare them to find an angle.

if u do a linetrace, in the “out hit” u can find the normal vector, if u invert the direction of that vector and use a dot product with the forward vector of the player, u can find the angle if u running towards a wall, if my logic does not fail me :face_in_clouds:

1 Like

I gather you mean the angle where the player intersects the wall if you was to draw a line (ie a trace) to it? You could use maybe Cartesian to Polar coordinates which would give you the angle.

Find the coords where the player line of sight meets the wall (object) and perform the conversion.

Not sure about @Husky211 response as i have never performed this and his method maybe much better, but check this out:

Hope it helps

Stewart

1 Like

This works perfect, thanks! :raised_hands: