Math problem help. (Adjust aim space values to point gun at target vector).

Hey guys, I’m asking for your help on a maths problem!

I’m setup an aim offset blend space for AI character. I’m trying to calculate the aim space values (UpDown/LeftRight) to make the gun point towards a target vector (EnemySeenLocation).

I’ve setup some debug lines to check that I have the correct socket location/forward vector. That is fine. I’ve messed with ‘FindLookAtRotation’, which I think is the right idea, I’m just not quite sure how to use the result to either set or increment the UpDown/LeftRight values.

Using ‘FindLookAtRotation’, am I right in thinking that I need to do something along the lines of offsetting the result by the rotation of the gun?

I’m sure it will be something so simple, I just can’t quite get it right! Thanks for you help!! :slight_smile:

This is what I’ve tried. Looks close, but no cigar.

I think I might have figured it out!

It SEEMS to be working. Unless you can spot a fatal flaw?