Garry's Mod

Garry's Mod

[CW2] KK INS2/DOI SWEPs (2018)
 This topic has been pinned, so it's probably important
Knife Kitty  [developer] Feb 17, 2018 @ 3:48pm
[2017/06/19] Animation blending and why I don`t use it.
TL;DR:
Aiming down the sights are two animations playing at once, sprinting is single animation. In GMod you can only play one animation at once.

Orig:
Aiming down the sights is delta animation/animation layer. In order to create aim-down-the-sight view DOI blends this layer with idle,iron_fire and other animations. Aim<->hip (or aimed near-wall<->hip near-wall holster) transitions you see in DOI is actually blending, not compiled animation you can just play at anytime(like draw/holster/reload/firing/.. for example). Left hand that holds pistol, which you see on M1911, is part of delta_iron - animation layer.

In GMod, you can`t just play animation with this layer(if you pass name of delta to SetSequence function, gun simply rotates by 90 degrees - goes off-screen). When you play iron_fire animations in GMod, you`ll notice they have same origin as hip fire anims - gun will not center itself on the screen, so obviously you need to blend delta and firing anims. So far, I have not been able to find a way to do this in GMod. Relatively recently added http://wiki.garrysmod.com/page/BaseAnimatingOverlay seemed to be what I needed but it is not (it doesn`t apply to entity type used by CW2 for viewmodels).

Aiming in CW2 base is code that shifts viewmodel`s relative position to player`s camera, not an animation compiled into viewmodel. CW2 creates sprinting, crawling, holsters and draws the same way by default.

This is how I see the situation, if anyone happens to have experience with animation blending in GMod(on purely client-side entities) and want to help, feel free to contact me.

Update: 6 May @ 7:50pm
Since this update you can enjoy two-handed aiming with M1911 and Webley, binoculars raising before changing to overlay and more-DOI-like aimpositions on rocket launchers. The way I achieved this is compiling custom viewmodels from sources included in DOI SDK. I have simply duplicated qc entries of aiming animations and included blend anims in duplicates. This way, sweps "fake" animation blending by using animations that have blend layers pre-compiled into them. Despite satisfying results, everything said above (in Orig section) still applies.