AI Aim Offset Math

Hello!

I am working on the math to calculate the pitch and yaw for my AI’s aim offset, but I’m just missing something. The numbers I keep getting are too small to lead to an aim offset, which leads me to believe I did my rotator/vector math incorrectly. Is this something someone can assist me with debugging? I will provide my c++ below!

Thanks!

For anyone that sees this in the future, here was my solution:

I am still having an issue with getting a feedback loop if i’m within about 3-5 meters of the enemy, they start to look straight up and then straight down rapidly, so I will have to fix this! But this should help you get closer to a solution.

1 Like