Calculating impact angles (for total armour values)

I am having some difficulty adding in armour angling and i need to calculate the “Effective” armour values.

Looking around I need to get the cosine but i am unsure about how to code it. I know the rest of my code works because i am getting the right figures.

I need to calculate the cosine value from the impact point.
on a perfect dead on shot (0 angling), it should be 0°. as it gets more angled it will start increasing the effectiveness of the armour.

73773-capture2.png

I am also unsure of where i need to start the impact point and calculate that from as well. Ideas /help?

Use Dot Product on (normal*-1) and (direction of hit). It will return a value, 1 to -1, based on the difference between the directions. 1 being perfectly aligned/straight against, -1 being opposite direction and 0 being a 90 degree hit. It should suit your needs.

Thanks for the quick reply, This was the route i went down, but I see I had to invert the vector before hand? Makes a tiny bit more sense, it seems to be working as required :slight_smile: