I'm trying to create a custom model for Team Fortress 2, in this case a very simple cylinder to replace the pyro's axe, just so I can learn the process. I've already made a hat for the workshop, so I have the basic process down. I've looked up endless amounts of tutorials, but none seem to successfully answer my question - in Blender, how do I rig my cylinder-axe so that ingame, when the pyro swings my cylinder follows?
I've decompiled the fireaxe, modeled my own replacement, then rigged my cylinder to the weapon_bone. That didn't work; the weapon floats around the pyro's head and never moves when he attacks. Next I tried importing in the entire pyro model, making my cylinder, and then rigging to the weapon_bone. Same result.
Basically, I'm making an item, and rigging it to the weapon_bone like all tutorials I've looked at say to do, but it doesn't work. Any help would be appreciated!
Replies
EDIT: After a bit more reading it looks like I'm gonna need to learn how to make my own .qc's and .vmt's. I think my hat worked because in itemtest I can automatically bind to bip_head, but otherwise (correct me if I'm wrong) I simply need to adjust my .qc file a bit to indicate the bone.
I've managed to put my custom shotgun model into TF2, but I can only see it from first person - on other characters it appears as the stock shotgun. Below is a screenshot, my .qc, and my .vmt.
As you can see, I copied the decompiled shotgun's .vmt and .qc files and modified them to suit my needs, so I suspect I failed to make a certain change which is resulting in the stock shotgun being used for the world model. Any help would be much appreciated!
pyro_shotty.qc
$cd "***directory***\pyro_shotty" $modelname "player\items\pyro\pyro_shotty\pyro_shotty.mdl" $model pyro_shotty "pyro_shotty.smd" $cdmaterials "models\player\items\pyro\pyro_shotty" $cdmaterials "" $hboxset "default" $hbox 0 "weapon_bone" -1.249 -3.844 -45.559 1.254 4.971 34.888 $hbox 0 "weapon_bone_1" -2.003 -2.277 -6.597 2.003 1.919 5.116 $hbox 0 "weapon_bone_2" -0.613 -0.602 -1.662 0.620 0.631 1.491 // Model uses material "models\player\items\pyro\pyro_shotty\pyro_shotty.vmt" $attachment "muzzle" "weapon_bone" 0.00 3.73 34.92 rotate -90.00 -0.00 0.00 $attachment "eject_brass" "weapon_bone" -0.80 3.25 10.76 rotate -11.66 162.02 -167.64 $surfaceprop "metal" $illumposition -6.167 0.000 0.564 $sequence idle "pyro_shotty" fps 30.00 $collisionmodel "pyro_shotty.smd" { $mass 4.8 $inertia 1.00 $damping 0.00 $rotdamping 0.00 }pyro_shotty.vmt"VertexLitGeneric" { "$baseTexture" "models\player\items\pyro\pyro_shotty\pyro_shotty" $BASEMAPALPHAPHONGMASK 1 "$phong" "1" "$phongexponent" "25" "$phongboost" "12" "$lightwarptexture" "models\lightwarps\weapon_lightwarp" "$phongfresnelranges" "[.25 .5 1]" "$rimlight" "1" "$rimlightexponent" "10" "$rimlightboost" ".175" "$glowcolor" "1" // Cloaking "$cloakPassEnabled" "1" "Proxies" { "weapon_invis" { } "ModelGlowColor" { "resultVar" "$glowcolor" } "Equals" { "srcVar1" "$glowcolor" "resultVar" "$selfillumtint" } "Equals" { "srcVar1" "$glowcolor" "resultVar" "$color2" } } }Though I can see nothing in your qc file that suggests it would work any differently.
Also, something interesting: in itemtest, when I choose for my cusotm shotgun to "replace" the default shotgun, it turns out like in the picture. But when I choose the reserve shooter, my custom model appears, only the shotgun shell is floating randomly (the rigging difference I mentioned).
So I guess I know how to fix the problem (using the reserve shooter not the stock shotgun), although it bugs me to not know why it fixes it.
EDIT: Can you help me understand the difference between c_models, v_models, and w_models?
If you want to know about the code, then I have no idea. I've never tried replacing a weapon that wasn't a c_model.
To get a general idea of the process, how would you replace a weapon that was a c_model? I rigged to the c_model's armature, copied its .qc and .vmt, and edited ithem to my needs. Am I missing a step?
EDIT: Something interesting, according to http://wiki.teamfortress.com/wiki/Team_Fortress_Wiki:3D_Models/Weapons the shotgun uses a w_model. Perhaps since I am supplying a c_model, when I replace the item in itemtest it supplies the default shotgun's w_model for the world model.
Though that may not be the case either, I replaced the pyro's fire ax and it showed my model as I taunted.
You may need to ask someone of the Steam forums or maybe FPS Banana. I've never made a weapon that wasn't melee yet.
EDIT: Seems to work fine if I "replace" the reserve shooter in itemtest. For the heavy, I replace the family business, for the engi, the frontier justice. As far as I can tell, there is some hard-coded setting for the stock shotgun to use its w_model, so in itemtest I can't tell it to use mine - it only uses my c_model for the viewmodel. Luckily, each class that uses shotguns has a non-stock shotgun, and these work fine for itemtesting.
I decided to post my results in case anyone else runs into this problem.