I’m relatively new to Unreal (been using Unity for years now) and am currently porting an FPS system prototype I did recently in Unity to Unreal in order to make an actual game out of it. Before porting those mechanics though I’ve wanted to properly set up a true first person camera that’s seen in games like Squad, ARMA, Ground Branch, and other realistic shooters. I’m essentially aiming to achieve something like this sample I came across when researching methods to implement this sort of system.
The (currently) desired features of my camera/character setup are as follows:
- Use a single character mesh (for the time being until I become better at 3D modeling)
- Use aim offsets to realistically have the upper body rotate with movement while keeping the weapon centered. The same example from above is an example of what I mean; as the camera yaws, the shoulders move but the gun doesn’t
- Rotate the lower body/character smoothly when the maximum rotation of the aim offset is reached. The above example ^ illustrates this as well.
- Feature a bit of the ‘weapon sway/rotation lag’ that’s used to give guns weight in most FPS games when aiming around. Something like this.
To do this so far I’ve been using animations from the “HeroTPP” mesh that comes with the official ShooterGame sample. I have the camera socketed into the head of the mesh in the blueprint with “Use Pawn Control Rotation” enabled. I created a 9 directional aim offset using aim poses that came with the HeroTPP model and setup a basic anim graph for moving and using the aim offset as per the official Unreal documentation for making aim offsets. I’m also blending an idle animation with the locomotion state machine to keep the hands from bouncing everywhere while moving.
The aim offset successfully rotates the camera and gun around when moving the mouse, but the gun mesh gets offset from the center of the screen due to the way the aim offset poses are setup. Additionally, to allow full rotation using the offset, I implemented a simple system to rotate the mesh of the character when the control rotation exceeds a certain degree threshold. This rotates successfully but produces a strange ‘snap’ effect on the gun when the rotation occurs no matter the speed of the interpolation. For the weapon sway, I made a simple lerp system that uses a pivot point in the blueprint to interpolate the mesh to the mouse position with some tweakable delay, but this only works when ‘Use Controller Rotation Yaw/Pitch’ are enabled, which prevent the usage of the aim offset.
I’ve been trying to solve these issues for several days now with no luck. For keeping the gun in the center of the screen like in the desired example at the top of the post, I’ve tried blending arm animations with the aim offset which hasn’t quite worked.
Sorry if this is a long post, I just want to provide as much information as possible at the outset. If anyone can provide any sort of help to at least get me started on a path to achieving the desired result from where I’m at I’d greatly appreciate it! Although I’m very experienced with C++ I’d prefer any blueprint examples since I’m still not up to speed with Unreal’s API just yet, but C++ is welcome as well!
Thanks to anyone who takes the time to help!
Here’s links to what I’ve described:
- Rotation snapping problem; note the ‘snap’ effect that occurs on the gun when the camera reaches the end of the aim offset as the character rotates
- Weapon position problem: note how the gun rotates far too much to the side when turning left.
- Anim graph
- Character blueprint
- Body rotation code