Needing help/information's about animation layer's [Source engine]
12 replies, posted
Hello!
I'm here with critical problem for me. First of all, some time ago I started working on animations for npc. I prepared some basic animations like idle, running in 8 directions and some of the other functions.
The time has come for animation layers and aimmarixs (for body_pitch and body_yaw parameters).When I load animation in blender I discover from decompiled sniper model from team fortress 2 (this is my reference to work with) that every aimmatrix animations looks like this!
https://files.facepunch.com/forum/upload/300891/faee8c77-2f37-445e-8b16-43fbd3df59c5/messy.png
Well, for my first look at the eye it looks like broken animation from decompile process. but no... when I'm trying to compile my decompiled sniper everything was okay.
I decided to reset pos parameters to see what's going on, but things are getting even worst.
https://files.facepunch.com/forum/upload/300891/2ecaaf3c-37a5-4752-9d10-6d6c74720333/messy1.png
I tried to solve this problem a couple months by myself, but with a poor effect. My model everytime looks messy after setting body_pitch or body_yaw on any value - basically I can't figure it out anywise.
I just emphasize that on the internet is nothing about layers in source (also in valve developer wiki). I'm tried even with NLA editor in blender that allows me to modify animation by other animations to make a brand new ones (mainly I'm using SFM for animating, so that's why even).
I would ask to explain the entire process step by step.
Thirdperson animations cannot be fully decompiled currently. the best you can do is guesswork.
Really? Well, Thanks for info, Thousands of hours are waiting for me setting infinity number of XYZ parameters.
This will be a bit of a long explanation, but I'll give it a shot. This assumes you have basic animation knowledge. The first thing I do is make a 11 frame animation. HOWEVER, this is not necessarily a requirement. You can do 9 frames, or 15 frames depending on how accurate you want the results. Since I use 11 I'll be using it as an example.
Basically, you want to make a scan pose. On each frame, have your character pose in a different direction.
https://i.imgur.com/JWTz2OJ.png
https://i.imgur.com/UmitxVq.png
https://i.imgur.com/jIJDyKp.png
In my example, I go Straight down, Downright, downleft, downcenter, centerleft, centercenter, centerright, upright, upcenter, upleft, straight up. The angle changes don't have to be precise, but it's better if it is. In my example, left to center is a 60 degree difference, and center to right is a 60 degree difference. center to up is a 45 degree difference, and up to straight up is a 45 degree difference. Export this as an 11 frame animation smd.
Now for qc stuff.
First I define a weightlist. In my example I just use all bones, so I use this weightlist
$Weightlist AllBones {
"ValveBiped.Bip01_Pelvis" 1.0
}
You can add more bones and fiddle around with it for various effects. Basically how it works is "Bonename" "Influence amount" (can be a value from 0-1)
Make sure this goes before your animation stuff in the qc
Next for some ik stuff. This ensures bones don't move where you don't want them to
$ikchain rhand ValveBiped.Bip01_R_Hand [Z 1] [height 6] [pad 2] [floor 7] [knee 0 0 0] [center 0 0 0]
$ikchain lhand ValveBiped.Bip01_L_Hand [Z 1] [height 6] [pad 2] [floor 7] [knee 0 0 0] [center 0 0 0]
$ikchain rleg ValveBiped.Bip01_R_Foot [Z 1] [height 12] [pad 2] [floor 8] [knee 0 0 0] [center 0 0 0]
$ikchain lleg ValveBiped.Bip01_L_Foot [Z 1] [height 12] [pad 2] [floor 8] [knee 0 0 0] [center 0 0 0]
$ikautoplaylock RLeg 1.0 0.1
$ikautoplaylock LLeg 1.0 0.1
$cmdlist lockfeet {
ikrule LLeg footstep height 20 floor 0
ikrule RLeg footstep height 20 floor 0
}
$cmdlist lockfeetandlefthand {
ikrule LLeg footstep height 20 floor 0
ikrule RLeg footstep height 20 floor 0
//ikrule lhand touch "ValveBiped.Bip01_R_Hand"
}
$cmdlist lockfeetnolefthand {
ikrule LLeg footstep height 20 floor 0
ikrule RLeg footstep height 20 floor 0
//ikrule lhand release
}
$cmdlist releasefeet {
ikrule LLeg release
ikrule RLeg release
}
You should be able to just replace the bone names with your names. I've fiddled with the other stuff and they don't appear to change anything (at least in gmod playermodels, might change with npcs)
More info here $ikchain
FInally, the fun part. The aim matrix.
Here's my raw code
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//AimLayers *Don't edit these unless you know what you are doing*
//
//Aimlayers are additive sequences that delta out the current animation, then apply poses based on which direction you are looking or "aiming"
//
//The extent these animations affect the model is defined by the "weightlist"
//The ikrule pretty much forces the left hand to stick with the right hand so it isn't desynced by our idle animation that we add to the sequence
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$definemacro MakeAimLayer layername filename \\
$animation a_$layername$_neutral $filename$ frame 5 5 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$animation a_$layername$_straight_down $filename$ frame 0 0 subtract a_$layername$_neutral 0 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$animation a_$layername$_down_right $filename$ frame 1 1 subtract a_$layername$_neutral 0 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$animation a_$layername$_down_center $filename$ frame 2 2 subtract a_$layername$_neutral 0 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$animation a_$layername$_down_left $filename$ frame 3 3 subtract a_$layername$_neutral 0 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$animation a_$layername$_mid_right $filename$ frame 4 4 subtract a_$layername$_neutral 0 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$animation a_$layername$_mid_center $filename$ frame 5 5 subtract a_$layername$_neutral 0 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$animation a_$layername$_mid_left $filename$ frame 6 6 subtract a_$layername$_neutral 0 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$animation a_$layername$_up_right $filename$ frame 7 7 subtract a_$layername$_neutral 0 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$animation a_$layername$_up_center $filename$ frame 8 8 subtract a_$layername$_neutral 0 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$animation a_$layername$_up_left $filename$ frame 9 9 subtract a_$layername$_neutral 0 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$animation a_$layername$_straight_up $filename$ frame 10 10 subtract a_$layername$_neutral 0 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$sequence $layername$ { \\
a_$layername$_straight_up a_$layername$_straight_up a_$layername$_straight_up \\
a_$layername$_up_right a_$layername$_up_center a_$layername$_up_left \\
a_$layername$_mid_right a_$layername$_mid_center a_$layername$_mid_left \\
a_$layername$_down_right a_$layername$_down_center a_$layername$_down_left \\
a_$layername$_straight_down a_$layername$_straight_down a_$layername$_straight_down \\
blendref a_$layername$_neutral \\
blendcenter a_$layername$_mid_center \\
blendwidth 3 blend aim_yaw -60 60 blend aim_pitch -89.99 89.99 \\
iklock rleg 1 1 iklock lleg 1 1 \\
delta \\
hidden \\
} \\
$continue $layername$
Now I'll try to explain it.
$definemacro MakeAimLayer layername filename \\ This is what is known as a macro. They make your life easier. "$definemacro MakeAimLayer" defines what the macro is called. With this, $MakeAimlayer becomes a command. "layername" is an argument for the command. Same with "filename"THE \\ ARE IMPORTANT AS THEY DEFINE THE MACRO BOUNDS. ADD THEM TO THE END OF EACH MACRO LINE.
We can call upon the macro like this
$MakeAimLayer aimlayer_pistol "ani/aimlayers/aimlayer_pistol_2handed"
any instances of $layername$ get replaced with aimlayer_pistol, and any instances of $filename$ get replaced with "ani/aimlayers/aimlayer_pistol_2handed" It's quite convenient, as we can just reuse the macro for all of the other weapons.
Now on to an explanation of the macro itself.
The first block is this.
$animation a_$layername$_neutral $filename$ frame 5 5 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$animation a_$layername$_straight_down $filename$ frame 0 0 subtract a_$layername$_neutral 0 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$animation a_$layername$_down_right $filename$ frame 1 1 subtract a_$layername$_neutral 0 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$animation a_$layername$_down_center $filename$ frame 2 2 subtract a_$layername$_neutral 0 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$animation a_$layername$_down_left $filename$ frame 3 3 subtract a_$layername$_neutral 0 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$animation a_$layername$_mid_right $filename$ frame 4 4 subtract a_$layername$_neutral 0 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$animation a_$layername$_mid_center $filename$ frame 5 5 subtract a_$layername$_neutral 0 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$animation a_$layername$_mid_left $filename$ frame 6 6 subtract a_$layername$_neutral 0 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$animation a_$layername$_up_right $filename$ frame 7 7 subtract a_$layername$_neutral 0 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$animation a_$layername$_up_center $filename$ frame 8 8 subtract a_$layername$_neutral 0 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$animation a_$layername$_up_left $filename$ frame 9 9 subtract a_$layername$_neutral 0 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
$animation a_$layername$_straight_up $filename$ frame 10 10 subtract a_$layername$_neutral 0 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
Remember our 11 frame animation? it gets used here. You may notice it only counts up to 10, that's because we start at 0.
What this macro does is chop up the 11 frame animation into individual poses then applies weightlists and ik and subtracts from the base pose.
We're going to work on the first line.
$animation a_$layername$_neutral $filename$ frame 5 5 weightlist AllBones ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource \\
Holy shit dude, this is gold, sorry if I don't have much to add to this thread (you did all of it basically), but this is really good stuff, I might save this thread for future reference.
Very good beginning. I can't wait for continuation. Well, some of the commands are new for me and It's a little bit complicated for now. Maybe it's just matter of time (I must analyze repeatedly many things often - this is who I am).
I will analyze tomorrow morning when I will begin my daily session of working.
From this place I'm really grateful!
$animation a_$layername$_mid_left $filename$
This defines an animation, and uses our $layername$ for naming. and $filename$ to grab the file.
This becomes
$animation a_aimlayer_pistol_mid_left "ani/aimlayers/aimlayer_pistol_2handed"
Quite nice right?
frame 5 5
frame is the next argument. This command defines a section of animation to use. Since we only want a pose, we start at frame 5 and end at frame 5 (5 is the centercenter of my aim animation)
weightlist AllBones
I use the weightlist all bones, but you can experiment if this doesn't suffice. For example, you might not use it when you have running animations, and instead make the legs not have any weight.
ikrule lhand touch "ValveBiped.Bip01_R_Hand" usesource
"lhand" was defined when we defined an $ikchain and "touch" basically parenting it to the right hand. I use this to ensure the left hand stays in sync with the right hand since I'm holding a weapon. You might not need this for one-handed, or no weapon animations. use source uses the original animation for ik goals. This is great since our animation is going to be a composite.
And that's the first line. The following lines are the same except for one difference.
subtract a_$layername$_neutral 0
We subtract the animation from the first pose. Since this animation is going to be an additive, we first subtract the animation from the base to get offsets, then add it back on. You could do this in your editor to skip this, but this is far easier :P
ONTO THE NEXT BLOCK
$sequence $layername$ { \\
a_$layername$_straight_up a_$layername$_straight_up a_$layername$_straight_up \\
a_$layername$_up_right a_$layername$_up_center a_$layername$_up_left \\
a_$layername$_mid_right a_$layername$_mid_center a_$layername$_mid_left \\
a_$layername$_down_right a_$layername$_down_center a_$layername$_down_left \\
a_$layername$_straight_down a_$layername$_straight_down a_$layername$_straight_down \\
blendref a_$layername$_neutral \\
blendcenter a_$layername$_mid_center \\
blendwidth 3 blend aim_yaw -60 60 blend aim_pitch -89.99 89.99 \\
iklock rleg 1 1 iklock lleg 1 1 \\
delta \\
hidden \\
} \\
$continue $layername$
This defines a sequence we use to eventually add to our target animation.
$sequence $layername$ { \\
a_$layername$_straight_up a_$layername$_straight_up a_$layername$_straight_up \\
a_$layername$_up_right a_$layername$_up_center a_$layername$_up_left \\
a_$layername$_mid_right a_$layername$_mid_center a_$layername$_mid_left \\
a_$layername$_down_right a_$layername$_down_center a_$layername$_down_left \\
a_$layername$_straight_down a_$layername$_straight_down a_$layername$_straight_down \\
blendref a_$layername$_neutral \\
blendcenter a_$layername$_mid_center \\
blendwidth 3 blend aim_yaw -60 60 blend aim_pitch -89.99 89.99 \\
This is a blend animation. The first 5 lines are a matrix. It goes from aiming straight up to straight down.
You can think of it as something like this
With each point on the object referencing a pose on the list.
blendref a_$layername$_neutral \\
This define the base pose and reference to align all of the other poses. We use the first animation we defined.
blendcenter a_$layername$_mid_center \\
The center animation or (0,0) when aiming.
blendwidth 3 blend aim_yaw -60 60 blend aim_pitch -89.99 89.99 \\
blendwidth defines how wide the stack is. How tall the stack is is determined by how many lines. (in our case 5)
blend aim_yaw -60 60 blend aim_pitch -89.99 89.99
Finally, our pose parameters. first number is a minimum, second number is a maximum. "aim_pitch" and "aim_yaw" are the names of them. Since you use "body_pitch" and "body_yaw" you can replace with those.
iklock rleg 1 1 iklock lleg 1 1 \\
delta \\
hidden \\
} \\
$continue $layername$
Finally, we have iklocks to prevent the feet from moving when we look up or down. Then we mark this as an animation to be added to another animation with "delta" and then hide it from hlmv with "hidden" $continue $layername$ lets us add any extra parameters if we need to to our macro definition. (I don't use any of them)
Finally, we go ahead and use all this with
$MakeAimLayer aimlayer_pistol "ani/aimlayers/aimlayer_pistol_2handed"
Now, on to the main sequences.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Idle Layers
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$definemacro makeidle idlename filename frame aimlayer \\
$sequence $idlename$ $filename$ alignto ragdoll frame $frame$ $frame$ numframes 118 loop fadein 0.30 fadeout 0.30 addlayer $aimlayer$ addlayer breath_layer node "standing" \\
$continue $idlename$
This is my idle macro. With your knowledge of macros, you should be able to understand how a bit of this works.
$sequence $idlename$ $filename$
Standard sequence definition, but we use our macro stuff here.
alignto ragdoll
We then align to our base pose to ensure sync.
frame $frame$ $frame$
I use my 11 frame sequence for the base pose of this animation, so I need to use the middle pose. You could replace $frame$ $frame with 5, but leaving it likes this allows us to use any base animation we want regardless of frame count.
numframes 118
I have an idle "breath" animation I use on top, so I make the whole sequence have the same amount of frames as that.
loop fadein 0.30 fadeout 0.30
Make the animation a looping animation and set the fade times (to prevent snapping to the animation. You can change these values to whatever looks good. They're defined as seconds.)
addlayer $aimlayer$ addlayer breath_layer
I then add my aimlayer and my additive idle animation (I didn't showcase it. If you need me to just let me know)
node "standing" \\
This defines it as a node in a node graph. I haven't played with it much, but with this you can define things such as transitional animations.
$MakeIdle idle_pistol "ani/aimlayers/aimlayer_pistol_2handed" 5 aimlayer_pistol ACT_HL2MP_IDLE_PISTOL 1
Finally, we use the macro. Thanks to the $continue, we're able to add the Activity to the end and it gets incorporated into the sequence.
I'll cover run and walk on the next part.
Okay, I've sorted it out somehow in my mind during this time. Sorry for for such a long time to this, but I had to do 72hr Jam entries, other stuff to do and mind regeneration.
Anyway during this time I've modify some raw codes for my preferences and it looks like this:
$definemacro MakeAimLayer aimmatrix_stand_idle anims\aimmatix_idle.dmx \\
$animation a_$aimmatrix_stand_idle$_neutral $filename$ frame 0 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource \\
$animation a_$aimmatrix_stand_idle$_down_right $filename$ frame 77 subtract a_$aimmatrix_stand_idle$_neutral 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource \\
$animation a_$aimmatrix_stand_idle$_down_center $filename$ frame 66 subtract a_$aimmatrix_stand_idle$_neutral 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource \\
$animation a_$aimmatrix_stand_idle$_down_left $filename$ frame 88 subtract a_$aimmatrix_stand_idle$_neutral 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource \\
$animation a_$aimmatrix_stand_idle$_mid_right $filename$ frame 11 subtract a_$aimmatrix_stand_idle$_neutral 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource \\
$animation a_$aimmatrix_stand_idle$_mid_center $filename$ frame 00 subtract a_$aimmatrix_stand_idle$_neutral 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource \\
$animation a_$aimmatrix_stand_idle$_mid_left $filename$ frame 22 subtract a_$aimmatrix_stand_idle$_neutral 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource \\
$animation a_$aimmatrix_stand_idle$_up_right $filename$ frame 44 subtract a_$aimmatrix_stand_idle$_neutral 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource \\
$animation a_$aimmatrix_stand_idle$_up_center $filename$ frame 33 subtract a_$aimmatrix_stand_idle$_neutral 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource \\
$animation a_$aimmatrix_stand_idle$_up_left $filename$ frame 55 subtract a_$aimmatrix_stand_idle$_neutral 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource \\
$animation a_$aimmatrix_stand_idle$_straight_up $filename$ frame 99 subtract a_$aimmatrix_stand_idle$_neutral 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource \\
$sequence $aimmatrix_stand_idle$ { \\
a_$aimmatrix_stand_idle$_straight_up a_$aimmatrix_stand_idle$_straight_up a_$aimmatrix_stand_idle$_straight_up \\
a_$aimmatrix_stand_idle$_up_right a_$aimmatrix_stand_idle$_up_center a_$aimmatrix_stand_idle$_up_left \\
a_$aimmatrix_stand_idle$_mid_right a_$aimmatrix_stand_idle$_mid_center a_$aimmatrix_stand_idle$_mid_left \\
a_$aimmatrix_stand_idle$_down_right a_$aimmatrix_stand_idle$_down_center a_$aimmatrix_stand_idle$_down_left \\
blendref a_$aimmatrix_stand_idle$_neutral \\
blendcenter a_$aimmatrix_stand_idle$_mid_center \\
blendwidth 3 blend body_yaw -45 45 blend body_pitch -45 90 \\
iklock rleg 11 iklock lleg 11 \\
delta \\
hidden \\
} \\
$continue $aimmatrix_stand_idle$
$definemacro makeidle stand_basic anims\stand_basic.dmx frame aimmatrix_stand_idle \\
$sequence $stand_basic$ $anims\stand_basic.dmx$ alignto ragdoll frame $0$ $0$ numframes 50 loop fadein 0.2 fadeout 0.2 addlayer $aimmatrix_stand_idle$ node "standing" \\
$continue $stand_basic$
$MakeIdle stand_basic "anims\aimmatix_idle.dmx" 5 aimmatrix_stand_idle ACT_STAND_IDLE 1
In this stage my compiler gives me error with message "Unknown macro token "0" in makeidle"
I have several reasons why it doesn't probably work:
I don't understand these 2 commands well : frame $0$ $0$ and numframes 50.
I skipped addlayer breath_layer command - basically I'm not sure how breath_layer animation must looks like, so you can just tell me.
Without $MakeIdle line compiler does his job with successful compile.
1 note here: I don't use straight_down animations because from what I see in tf2 playermodel doesn't have this. In total they have only 10 frames.
$definemacro MakeAimLayer aimmatrix_stand_idle anims\aimmatix_idle.dmx
You're stating an animation when defining your macro.
replace
"anims\aimmatix_idle.dmx
with
filename
Basically how macros work is you have
$definemacro example parameter1 \\
"parameter1" is just a name that's used to "fill in the gaps"
you code might have
$sequence $parameter1$ anim/$parameter1$.smd \\
You put $parameter1$ wherever you want the information to go.
When I call the macro using the first word
$example
like so, the next spot where parameter1 is will be the text I want to replace
$example coolidle
All instances of $parameter1$ will be replaced with that text. So you'll go from this
$sequence $parameter1$ anim/$parameter1$.smd \\
to this.
$sequence coolidle anim/coolidle.smd
for "frame $0$ $0$" remove the $ so you end up with "frame 0 0" since you never define "0" in your definemacro line
Okay, finally, I figured it out and ever It work's as I wanted. Here is my code:
$animation a_aimmatrix_stand_idle_neutral "anims/aimmatix_idle_2.dmx" frame 0 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource
$animation a_aimmatrix_stand_idle_down_right "anims/aimmatix_idle_2.dmx" frame 7 7 subtract a_aimmatrix_stand_idle_neutral 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource
$animation a_aimmatrix_stand_idle_down_center "anims/aimmatix_idle_2.dmx" frame 6 6 subtract a_aimmatrix_stand_idle_neutral 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource
$animation a_aimmatrix_stand_idle_down_left "anims/aimmatix_idle_2.dmx" frame 8 8 subtract a_aimmatrix_stand_idle_neutral 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource
$animation a_aimmatrix_stand_idle_mid_right "anims/aimmatix_idle_2.dmx" frame 1 1 subtract a_aimmatrix_stand_idle_neutral 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource
$animation a_aimmatrix_stand_idle_mid_center "anims/aimmatix_idle_2.dmx" frame 0 0 subtract a_aimmatrix_stand_idle_neutral 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource
$animation a_aimmatrix_stand_idle_mid_left "anims/aimmatix_idle_2.dmx" frame 2 2 subtract a_aimmatrix_stand_idle_neutral 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource
$animation a_aimmatrix_stand_idle_up_right "anims/aimmatix_idle_2.dmx" frame 4 4 subtract a_aimmatrix_stand_idle_neutral 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource
$animation a_aimmatrix_stand_idle_up_center "anims/aimmatix_idle_2.dmx" frame 3 3 subtract a_aimmatrix_stand_idle_neutral 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource
$animation a_aimmatrix_stand_idle_up_left "anims/aimmatix_idle_2.dmx" frame 5 5 subtract a_aimmatrix_stand_idle_neutral 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource
$animation a_aimmatrix_stand_idle_straight_up "anims/aimmatix_idle_2.dmx" frame 9 9 subtract a_aimmatrix_stand_idle_neutral 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource
$animation a_aimmatrix_stand_idle_straight_down "anims/aimmatix_idle_2.dmx" frame 10 10 subtract a_aimmatrix_stand_idle_neutral 0 weightlist weights_aimmatrix_stand_idle ikrule lhand touch "bip_hand_R" usesource
$sequence "aimmatrix_stand_idle" {
a_aimmatrix_stand_idle_straight_up a_aimmatrix_stand_idle_straight_up a_aimmatrix_stand_idle_straight_up
a_aimmatrix_stand_idle_up_right a_aimmatrix_stand_idle_up_center a_aimmatrix_stand_idle_up_left
a_aimmatrix_stand_idle_mid_right a_aimmatrix_stand_idle_mid_center a_aimmatrix_stand_idle_mid_left
a_aimmatrix_stand_idle_down_right a_aimmatrix_stand_idle_down_center a_aimmatrix_stand_idle_down_left
a_aimmatrix_stand_idle_straight_down a_aimmatrix_stand_idle_straight_down a_aimmatrix_stand_idle_straight_down
blendref a_aimmatrix_stand_idle_neutral
blendcenter a_aimmatrix_stand_idle_mid_center
blendwidth 3 blend body_yaw -45 45 blend body_pitch -90 90
iklock rleg 1 1 iklock lleg 1 1
delta
hidden
}
$sequence "stand_basic" {
"anims\stand_basic.dmx"
activity "ACT_MP_STAND_BASIC" 1
fadein 0.2
fadeout 0.2
addlayer "aimmatrix_stand_idle"
fps 24
loop
}
As you can see I remove all this macro stuff specially to see what the effects will be and it works very well even without it. My question is, because I didn't understand the purpose of macro well - this this is definitely necessary? You know, when programmer will working on NPC with my model will have a little trouble with this or or rather not?
The macro is useful when you're making a bunch so your qc doesn't get cluttered. So I can do stuff like this
$MakeAimLayer aimlayer_ar2 "_anim/_aimlayer/aimlayer_ar2_blend"
$MakeAimLayer aimlayer_camera "_anim/_aimlayer/aimlayer_camera_blend"
$MakeAimLayer aimlayer_crossbow "_anim/_aimlayer/aimlayer_crossbow_blend"
$MakeAimLayer aimlayer_crowbar "_anim/_aimlayer/aimlayer_crowbar_blend"
$MakeAimLayer aimlayer_dual "_anim/_aimlayer/aimlayer_dual_blend"
$MakeAimLayer aimlayer_fist "_anim/_aimlayer/aimlayer_fist_blend"
$MakeAimLayer aimlayer_grenade "_anim/_aimlayer/aimlayer_grenade_blend"
$MakeAimLayer aimlayer_magic "_anim/_aimlayer/aimlayer_magic_blend"
$MakeAimLayer aimlayer_normal "_anim/_aimlayer/aimlayer_normal_blend"
$MakeAimLayer aimlayer_passive "_anim/_aimlayer/aimlayer_passive_blend"
$MakeAimLayer aimlayer_pistol "ani/aimlayers/aimlayer_pistol_2handed"
$MakeAimLayer aimlayer_revolver "ani/aimlayers/aimlayer_revolver_alt"
$MakeAimLayer aimlayer_rpg "_anim/_aimlayer/aimlayer_rpg_blend"
$MakeAimLayer aimlayer_shotgun "_anim/_aimlayer/aimlayer_shotgun_blend"
$MakeAimLayer aimlayer_slam "_anim/_aimlayer/aimlayer_slam_blend"
$MakeAimLayer aimlayer_physgun "_anim/_aimlayer/aimlayer_physgun_blend"
$MakeAimLayer aimlayer_smg1 "ani/aimlayers/aimlayer_smg"
instead of using the above line 18 or so times.
To be honest disorder in my code is not that big issue. I prefer to have a little mess in my code if my simple code are understandable for me now. But I will keep in mind that macro can order my code better and maybe If I will have something more serious to make I will look at it closely.
You mentioned, about run and walk for the next part, but I already had it before and my code even worked. If you want write this part it would be good just even for next creators!
Anyway, I have no more questions, I would like to thank you again that you led me on a good track. You made me continue my project which is really important to me. Maybe soon you will see the essence of my work in the future, but there is still a long way to finish. Writing this code this is only a small part I want to do.
Seemingly you made very good thing! God bless you!
@Stiffy360
Thank you for this beautiful writeup. You mentioned your intention to cover running and walking next, would this still be possible? Are there any resources out there on this? I wasn't able to find any and finally stumbled upon this after many hours.
I'd like it if you could add me on Steam: https://steamcommunity.com/id/xaviergmail
Sorry, you need to Log In to post a reply to this thread.