I’m developing a game with an Alien Shooter style control (Alien Shooter Gameplay - YouTube - Alien Shooter gameplay). Since I’m not good at 3D modelling, I used Epic Games AnimStarterPack to animate my character. Here is a brief how-to I implemented an AimOffset asset.
AnimStarterPack provides an animation sequence Anim_Space_Hip, which is simply a sequence of 9 poses. Those poses cover 180 deg. yaw and pitch angle. To make a character to aim its weapon smoothly, those poses must be blended according to two given parameters: yaw and pitch angles.
Export Aim_Space_Hip animation somewhere and import it 9 times, each time choose the frames range which correspond to the pose. The editor doesn’t allow to import a one frame animation, so choose 2 frames and then delete one frame in the editor. Note, that some poses have a one frame “extremum” and if we don’t want a quivering pose there must be only one frame in a pose animation.
Importing the “centre-up” pose.
Give proper names to the pose animations, like CC for “centre-centre”, LU for “left-up” and so on. After importing, open the animation and change Additive Anim Type to Mesh Space, Base Pose Type to Selected animation frame and choose below Idle_Rifle_Hip asset. Right-click on the Sequence Editor and Remove from frame 1 to frame 2. Finish up with 9 poses in this way and proceed to creating an AimOffset asset.
To create an AimOffset asset and get a basic idea of it, check the documentation page Aim Offset in Unreal Engine | Unreal Engine 5.0 Documentation. Along the X axis determine the yaw angle, along the Y axis - pitch angle. Set -90 … 90 deg. range and 4 divisions for both. Put all the “down” poses on the bottom row, i.e. “left-down”, “center-down” and “right-down”. On the middle row put “center” poses and, finally, on the upper row put “up” poses. Change Preview Base Pose to Idle_Rifle_Hip to check what’s done.
Final AimOffset asset.
Check out the Content Examples demo to get an idea how to aim your character run time Content Examples Sample Project for Unreal Engine | Unreal Engine 5.0 Documentation. In my case, the yaw and pitch angles are defined by a point in the world the cursor hovering over.