So i have an ai controlled pawn with a blendspace aim offset and it works pretty well, except that the offset values are not correct, causing the ai most of the time to miss its target; i’m doing something wrong with my calculations and i believe its because the forward vector of the weapon is not aligned with the forward of the pawn.
TLDR i have to calculate the LeftRight and DownUp values of the AimOffset in order for the weapon to be aligned with its target. How can i do this ?
Ok so i’ll post the (rather simple) solution if somebody run into the same problem: you take the rotator of your muzzle, you produce a rotator based on the forward vector [targetLocationVector - MuzzleCenterVector], you take the delta of the two and the pitch and yaw are the values you need for the aimOffset in order for the pawn to shoot straight regardless how his weapon is positionned.
Pls can u make some kind of picture (BP) ?
I tried your solution, but it didnt work at all.
I tried to rotate just withlut any weapon offset rotation.
(as you can see on my pics below).
And i still cant aim my weapon(with my char) to target location.
My char is rotating, but his weapon looking a slightly another direction, because its socketed with hand bone, and therefore misdirected to straight ahead.
I have ticking rotations, with one RotationPoint vector which is point to target actor.
And i have weapon actor attached to pawn mesh.
But when i try to adjust rotation of my char, it does infinite circles.
Found that pitch aim value will be wrong in degrees. Because -90 and +90 with AIM offset isnt the same in degrees. Its just animation interpolation ratio. IMAO