How should I go about animating a complex weapon?

I’m pretty new to Blender in general, and the past months I just focussed on hard surface. My current goal is to create an AK rifle with a “functional” mechanism. So when the trigger is pulled, the hammer should hit the bolt, the carrier should be pushed back, fling the shell out, cock the trigger again, and chamber a new bullet.

Now the ridiculous part: the rifle should be rigged to a set of first person arms and be usable in unreal engine as a first person weapon (because reasons).

The modelling is pretty much finished, so now I’m starting to think about the animation aspect. I never animated a thing in my life before, and moving the carrier back and forth with keying the x-movement is my level of experience in animation.

So before I go and make a big mess, I thought I’d get my thoughts checked here.

That’s what I got in my head so far:

  • Animating the parts in local mode and parenting them together will keep the animation no matter how the rifle itself is positioned

  • I can use drivers to trigger animations. So if the trigger has rotated x degrees, it’s enough for the hammer to be released and hit the bolt. > If the hammer has rotated x-degrees (or moved if you will), the carrier will sling back. > etc.

    • additionally, I can use a bone for the carrier, I can drag the carrier back and forth as if it was a physical object, effecting the other parts depending on the carrier’s position. So it’s all about fine tuning the drivers.
  • since all these logics rely on local coordinates, it is irrelevant how parent-rifle is located globally, so I can easily rig the parent with a single bone, and all other animations will follow along (Do all parts need to share a vertex group weighted 1, or just the parent?)

  • As the recoil is a combination of drawback and the force of the arms holding the rifle, it’s best to create an extra armature for the recoil, with affects hands and rifle equally, so the strength can be adjusted independently

One question regarding the shell-eject: Is it enough to animate the first moments of the eject, and then let a physics sim take over. Will the keyed animation create an inertia used by the physics system?

I’m sorry if all these things are already answered somewhere here, I researched a few hours but couldn’t find definitive answers to my questions. I guess I could resolve them with experimentation, but I’d like get my thoughts reviewed before going into the experimental phase.

Thanks for any help

I’m not entirely sure how you intend to rig it in Unreal, but a general flow would be to parent-together everything that is physically connected, then keyframe-animate each move. However, separate each move: the cocking sequence, the trigger motion, the muzzle burst, the recoil, the bullet flying out, movement of the belt of ammo if there is one. Ignore motions that you can’t see like the bullet being pushed into the chamber unless you are building a documentary of how it worked.

Yes, you will be using local coordinates, except for things like recoil.

In pure-Blender, you would then step up to using “NLA = Non-Linear Animation” to assemble these so-called “actions” into a complete timed sequence. You can very easily blend the influence of several actions in this way.

I would animate the shell and with a hefty blur. You probably don’t need its motion to be “physically correct,” and I’ve never seen a game where there were actually “piles of spent casings on the ground.” Somehow they tend to magically disappear. Literally, it just has to look “convincing … enough.”

Drivers might be helpful, or they might not. You’re not having to animate arbitrary movements of this weapon. You are designing particular shots where, from different cameras and angles, you are depicting this weapon being fired by a soldier. The focus of the shot, also, is never on the gun. No one’s looking at the gun: they’re looking at the soldier and the bad guys. So, do exactly enough to get the work done convincingly and quickly in Unreal, for the shots and angles that you intend to use.

Often I’ll keyframe-animate something roughly before deciding whether I want to drive it. I’m much more likely to drive it when the focus of the piece is on “how a machine works.” (I do a lot of that.) But the keyframe rough-in will tell me how the drivers need to work, not the other way around! And if curves are good enough … no drivers. Lazy me.

The mix of actions that you actually use will also depend on where the camera is … that is, on which camera you are using right now. “Perform for that camera.” You might have many actions that “do” the same thing in different ways.

If you’re animating recoil, that’s really a combination move of the gun and the actor who is holding it, and this might be easiest to animate as an animation of the actor, not the gun. But once again, expressed as an “action.” The gun is attached to the actor and is moved by him even though we “know” that the gun is the one producing the force.

1 Like

Thanks a lot!

If I got you right, I can rather use different animation sequences and spare myself the driver work. Though in theory, if I want to create a lot of iterations and shots, drivers could end up saving me time. So it’s a balance between amount of shots/ease of sequencing compared to drivers.

Regarding UE, as far I know, you can import custom armatures into Unreal. There are tutorials on how to rig a usual rifle to hands, make a magazine change animation and import it to Unreal. That’s where I would start from. But I guess I’ll have to make some more research in regards to how to get the animations into UE. I believe UE has an equivalent of NLA, so I guess the NLA part is done on the unreal side. On the other hand they are currently working on a live link for blender, so maybe I can stay in blender alltogether. I will have to see about that. Regarding drivers and UE, I’d just guess that could be problematic as the animation logic won’t translate. So I guess I won’t get around animation sequencing. But that’s alright. After all, even if it’s a lot of shots/movements, they are still fixed and finite. Thanks again, this pushed me in the right direction.

Regarding the case eject, I’d just use the physics sim to create a believable movement, and then bake that sim. Maybe in a few variations.

The reason why I want to animate the whole weapon as a physically believable unit, is because I learned from the Metro series, that a great deal of player<>game interaction depends on the tools the player uses in the game. So I want to give the player as much control about the rifle as possible without ending up as a rifle simulator. pressing R should just recock the gun (and eject a useful bullet you can pick up again after from the ground. So if you want to, you can empty your whole mag on the spot like an idiot, watching the bullets fly and hearing the pling sounds), holding R should reload. This can then get combined with a jamming mechanic etc.
Also you should be able to remove the cover to look at the receiver and all it’s parts. Stuff like this is completely unneccessary from a pure gameplay perspective, but it greatly adds to the feeling of being connected to the game world. Just by giving the possibility of interaction. Your tools are all the means you got to directly interact with the world in a game, and I can always remove what can not be seen to save resources later on.

Hey :slight_smile:

i don’t know anything about this subject but here’s a course that may be useful to you ?

1 Like

Awesome man, thanks! This is exactly what I need lol. How could I not find this, I already saw a bunch of other cgcookie courses, but none going into rigging an animated rifle. Definetely going to buy this!