Download

Getting my bot to aim directly at me, need advice from vector expert.

So I am trying to get my bot to hit me when it shoots. It is using an aimoffset asset.

I am getting the look at rotation from it’s weapon to me and applying this rotation to the aimoffset, this is close, but not close enough to hit me. The offset of the weapon from the bots root is interfering and this offset is not a constant distance/location throughout the aimoffset.

I am trying to think of what calculations I can do to account for this offset, or a system to ‘home’ in on my character instead of this hard coded rotation system which I am not a fan of.

Are those “Bullets” traveling like Rockets or is it like a ShockGun (Instant Hit)?

I am using projectile movement but that is not the issue.

EDIT: I am onto something, if I get the ‘delta rotator’ of the ‘look at rotation’ from the guns muzzle to my character, and the rotation of the muzzle socket, it gives me the number of degrees that the gun is off by. Now I need a way to implement this correction. I tried simply combining it with the look at rotation, but as I had guessed it behaved like an underdamped system just sweeping the gun back and forth across me.

Piece of advice: don’t launch the projectile straight outward from the socket on the enemy gun. This is inviting problems.

Use your look at rotation to turn the enemy as close as is feasible (so he appears to be aiming at the player), and then spawn the projectile at the muzzle tip socket and rotated to the Look At Rotation (rather than the socket rotationn) so it always flies straight at the player from its spawn point. This way even if animation blending or offsets aren’t exactly perfect, the projectile’s trajectory will be.

Nobody is going to notice the difference, and it will save you tremendous headaches being able to skip making the aim offsets pixel-perfect (especially since even tiny errors become meaningful at long enough distances).

I wanted to avoid doing that as I am sharing weapons bp’s between the bot and the player, also I wanted to have true movement based recoil, but if I can’t get it to work right then that is what I will do.