Procedural FPS Weapon Mechanics for Noobs

Hi everyone that reads this,

I am relatively new to Unreal and some experience with coding but non with animation. I have been working on this project for a few months, the concept for it is to achieve as close to fully Procedural TFPS weapon handling as possible using UE 5.1.

I have the True FPS character set up with a pistol attached to a socket on the characters right hand. I am then using an Animation blueprint that has a single frame idle pose holding a pistol hooked up to an aim offset that is only moving the head of the character so we can look around. this is then linked to a control rig.

My Goal in this exercise is to use the looking around aim offset to procedurally influence the characters arms and hands to aim the gun at what the character is looking at. But I am struggling with 2 aspects of this goal:

  1. Is the handling for the arm movement, I have tried to use Virtual bones and control rig controllers to achieve this but I missing something. I had two controllers bones one for the head and one for the hand parented to the head one.
    I was then copying the head socket transform the camera uses to the head controller and tried to offset its child hand controller to the hand but can’t figure out how to set the offset correctly or how to keep the heads influence over the child once it has been offset. if I try to apply IK to the hand so it uses the hand control location then the hand will just drift off into the abyss.

  2. Is aiming the muzzle of the gun from the offset pivot point that is the character wrist to the desired target.
    This one I have played with in control rig by taking the muzzle point and the target then pushing it through an Aim node in control rig then applying the result rotation to the hand controller. This looks like it was working but I had to adjust the Aim node axis to correct the hand rotation to actually face the target direction.

I am really looking for help with understanding these points in more detail and if there is any easier ways to implement my ideas here.

Also sorry in advance if I end up asking some stupid questions, Thank You!

Forget control rig and look at old tutorials.

You need an inverse IK setup to do proper aiming.

Aimoffsets can work, but you would have to define the poses mathematically for them to be only somewhat accurate looking.

Thing is, most fps are less than somewhat accurate, so maybe thats OK too.

If you go that route, simply pose the mesh in a DCC - in first person view, with an IK solver, while aiming/holding the barrel where you want it to aim based on the max/min values of the offset you want (Normally up/down 0 to 60, left/right 0 to 90 plus diagonals).
You have to make sure your camera FOV is the maximum value your project’s will ever be.
In theory, you can then shorten the values based on the fov so as to make sure that the uppr right corner is the upper right, and not off screen.

After that, remeber you can’t acrually shoot out of the barrel. Its an approximation. Your weapon needs to fire from the chamber to the reticle. Usually its just a line trace even on AAA titles anyway.

If you wanted to do it properly, then youd do the IK in unreal, and adjust your bone position based on the final aim point.
The arm chains are 3 bones each, and you really do get unnatural wrist movement if you don’t set it right. Thats particularly disturbing in first person as the wrist bones often look broken, so be mindful of the setup.

So I have seen a few tutorials my favourites being the SneakyKitty procedural aim down sight youtube tutorial as well as the KarlLewisdesign 3 page ADS walkthrough blog. do you know any others that are along this premise or could maybe be better?

Also can I ask why do you say forget control rig? my understanding is that it can be used to create procedurally driven animations, is there something that hinders it from actually handle procedural animation? Also if not control rig would the VB system used in the other tutorials be the best alternative to use?

I use blender and have create my character rigs and guns in there, and exported the assets across using the blender to UE tool developed by Epic. I can create poses but that is the limitation of this exercise for me, I want to handle this using a single pistol and rifle forward aim pose. This is ultimately to see if I can create a complete tarkov like weapon handling system procedurally off of these two poses.

Ambitious… ok probably more dumb, but I have already got the firing of the weapon working as I am using a ballistic projectile approach based off what games like Arma. I am also not worried about it looking too unnatural as long it is passable, as the game is actually an RTS with an FPS possession mechanic.

1 Like

Because it’s relatively new and adds in a bunch of overhead that you dont necessarily need, since you know, the systems which work have been in place long before.
Now, if you want to study how those work and replicate them in control rig, sure, its possible. But you have to make sure you aren’t adding in extra load just becauae of using control rig too, since its obviously not required to make said systems work.

No, in theory, it is partly what it was built to do.
Except it was originally made to sync up different meshes with different extra bones to base animations of a different skeleton.
And it then got adapted to just work on the main skeleton itself. So you have to check how performant the latest iterations are…

If VB stands for virtual bones. Those too are new-ish.

The oroginal epic skeleton had extra IK bones which are useful (and used by most setups) for habdling weapons.

Nothing prevents you from adding weapon specific bones to your character so you can animate the gun properly (putting away a rifle is different than holstering a gun. Do you really heed 2 bones? No, but will it hurt to have 2? Not really, so why make things complicated when you can add in the extra bone?).
That however is a different discussion - you need those regardless of the setup to aim, which will in all likelyhood use the IK hand bones.

As far as specific tutorials, I’m not sure really. I just went with what was right for my project. There’s a billion different ways to do this even with the primitive tools, so you just have to learn how the basics work to make up your own system.

A few things you may want to work into in advance:

Hand position varies on a weapon by weapon basis. Each weapon needs to be offset to its socket on the weapon bone differently to be able to share animations.
Rifle requires 2 hands, so you need to allow weapons to define L and R offsets for each socket.
I don’t think you should use 2 sockets on the main actor, but you can add sockets to anything - and therefore adding sockets to the weapon itself could help in defining the offsets visually.

Solving the IK chains backwards you need to keep count of proper elbow pole position - adding a bone may seem like a good idea here, but what if a different rifle requires a different position?
As such, we go back to having the weapon defining elbow offsets too. This time probably using values for an offset instead
(For noncomplicated setups just put the elbows inwards to support weight as a proper shooting stance should always be. Left hand forward hand elbow points down. Trigger hand points as down as it can, limited by trigger locarion).

Running or walking with dofferent rifles requires to adjust left/right position of hands holding it based on weapon weight. Different weapons swing differently.

Different character structures - wide shoulder vs narrow - will need different IK values to move the rifle Up for wide, down for small generally, in order to possibly fit similarly.

Above all remeber that the IK setup is a suggested location.
The character will try to reach it. If your limits are correct, gripping a 2cm large AK will result in the forward hand failing to reach its location and looking OK anyway. (I’d suggest that if the target is not matematically reachable you change animations/drop the second hand, but that’s probably more of a nuance).

Last tip. Working without control rig, the fabrik solver is probably the best one to use.
Different solvers have different load on the system. Iccd is lighter for instance. Fabric means more control. And the other ones are situational at best.
Also, the location in the ABP hierarcy is likely after all animations have already occurred, like for leg IK. But the offsets should only be active when needed (done via an alpha value).