Weapon World Models Have No Physics

Hello,

So I recompiled a model and recompiled it, changing texture paths and such. It works flawlessly, except for that when dropped in game, the model has no physics. I’ll post any additional information you want, just let me know as I don’t want to spam you with useless info.

Thanks,
Zeph

Make sure that your $collisionmodel line in your .qc is reading the model reference file instead of the physmodel.smd file.

So instead of


$collisionmodel "phymodel.smd" {

	$mass 5.0
	$inertia 1.00
	$damping 0.00
	$rotdamping 0.00
}

it would read


$collisionmodel "w_weapon_reference.smd" {

	$mass 5.0
	$inertia 1.00
	$damping 0.00
	$rotdamping 0.00
}

Like that?

Yes, except that you name the coliision reference exactly as you would for the weapon reference itself. For example, let’s say your weapon reference is labeled this_is_a_horrible_example.smd. Your $collisionmodel line would read as follows:


$collisionmodel "this_is_a_horrible_example.smd" {

	$mass 5.0
	$inertia 1.00
	$damping 0.00
	$rotdamping 0.00
}

After that, it should compile just fine and work as intended.

Yeah, got it. Just did that, recompiled, uploaded, deleted from my downloads, redownloaded from server. Same problem.

Post your .qc, I’ll take a look.


$cd "H:\Decompiled Models\Barrett\World"
$modelname "tg\weaponsbetav1\M82\World_Model\w_tg_snip_m82.mdl"
$model "studio" "w_m82_reference.smd"
$cdmaterials "models	g\weaponsbetav1\M82\World_Model"
$hboxset "default"
$hbox 0 "ValveBiped.Bip01_R_Hand" 0.000  -1.500  -5.000  5.000  0.000  0.000
$hbox 0 "ValveBiped.Weapon_bone" -6.236  -0.766  -3.310  11.949  1.111  7.763
// Model uses material "Scope.vmt"
// Model uses material "Lens.vmt"
// Model uses material "Main.vmt"
$attachment "muzzle" "ValveBiped.Bip01_R_Hand" 35.52 -1.53 -10.18 rotate 9.00 0.00 -92.00
$attachment "1" "ValveBiped.Weapon_bone" 0.40 -0.77 -0.00 rotate 2.00 90.00 -81.00
$surfaceprop "weapon"
$illumposition -14.329 -1.780 0.320
$sequence idle "idle" fps 30.00
$collisionmodel "w_m82_reference.smd" {

	$mass 5.0
	$inertia 1.00
	$damping 0.00
	$rotdamping 0.00
}


Well, the first thing that catches my attention is that the $sequence line needs to be updated:


$sequence idle "idle" snap rotate -90 fps 30.00

Everything else seems to be in the right place, unless I’m missing something. I’d at least give the updated $sequence a try first, though.

Alright, I’ll give that a try, in the meantime, where are model events defined?

For example, for the event “Weapon_M82.Boltup” in the view model, where would it define what that event entails, sound wise as well as otherwise?

Still has no physics after changing $sequence.

another thing that catches my attention is that you have $mass 5.0 which would normally be $mass 5.00, it might not fix it but its worth a shot.

Changed $sequence to


$sequence "idle" "idle.smd" FPS 30.00

after some googling and talking to people on Steam.

World model is now perfect, however the view model is invisible. Would this be a model or texture problem? (I’m guessing model because I believe the texture would be black and purple if it was that type of problem, I could be wrong). Assuming its a model problem, here’s the view model .qc


$cd "H:\Decompiled Models\Barrett - Copy\View"
$modelname "tg\weaponsbetav1\M82\View_Model\v_tg_snip_m82.mdl"
$model "studio" "v_m82_reference.smd"
$cdmaterials "tg\weaponsbetav1\M82\View_Model"
$cdmaterials "models\weapons\v_models\hands\"
$hboxset "default"
$hbox 0 "Body" -1.537  -14.323  -4.043  1.537  35.640  5.074
$hbox 0 "mag" -0.583  -2.503  -2.907  0.583  2.503  2.907
$hbox 0 "handl" -2.609  -2.958  -0.067  0.066  0.811  4.426
$hbox 0 "bolt" -0.725  -4.685  -0.586  0.725  4.685  0.586
$hbox 0 "L_Forearm" -0.340  -1.685  -1.523  8.109  1.675  1.276
$hbox 0 "L_Wrist" 0.000  -1.486  -1.254  3.495  1.746  1.005
$hbox 0 "L_Thumb1" 0.000  -0.507  -0.685  1.979  0.834  0.689
$hbox 0 "R_Forearm" -0.339  -1.713  -1.276  8.109  1.647  1.523
$hbox 0 "R_Wrist" 0.000  -1.766  -1.231  3.495  1.531  1.005
$hbox 0 "R_Thumb1" 0.000  -0.572  -0.699  2.114  0.736  0.673
// Model uses material "m82.vmt"
// Model uses material "v_hands.vmt"
// Model uses material "Main.vmt"
// Model uses material "Scope.vmt"
// Model uses material "scope_ch.vmt"
// Model uses material "scope_rt.vmt"
$attachment "1" "Body" 0.00 36.00 -0.50 rotate -0.00 0.00 0.00
$attachment "2" "bolt" 0.30 -0.00 -0.00 rotate 0.00 -15.00 -0.00
$surfaceprop "default"
$illumposition -21.075 -1.260 -7.338
$sequence idle "idle" ACT_VM_IDLE 1 fps 30.00
$sequence fire "fire" ACT_VM_PRIMARYATTACK 1 fps 35.00 {
  { event 5001 0 "1" }
  { event AE_CLIENT_EFFECT_ATTACH 2 "EjectBrass_338Mag 2 50" }
}

$sequence draw "draw" ACT_VM_DRAW 1 fps 30.00
$sequence reload "reload" ACT_VM_RELOAD 1 fps 31.00 {
  { event 5004 17 "Weapon_M82.Boltup" }
  { event 5004 49 "Weapon_M82.Clipin" }
  { event 5004 74 "Weapon_M82.Clipout" }
  { event 5004 85 "Weapon_M82.Boltdown" }
}

And here’s the relevant part of the weapon lua:



--Begin Models
resource.AddFile("models/tg/weaponsbetav1/M82/View_Model/v_tg_snip_m82.dx80.vtx")
resource.AddFile("models/tg/weaponsbetav1/M82/View_Model/v_tg_snip_m82.dx90.vtx")
resource.AddFile("models/tg/weaponsbetav1/M82/View_Model/v_tg_snip_m82.mdl")
resource.AddFile("models/tg/weaponsbetav1/M82/View_Model/v_tg_snip_m82.sw.vtx")
resource.AddFile("models/tg/weaponsbetav1/M82/View_Model/v_tg_snip_m82.vvd")
resource.AddFile("models/tg/weaponsbetav1/M82/View_Model/v_tg_snip_m82.xbox.vtx")
resource.AddFile("models/tg/weaponsbetav1/M82/World_Model/w_tg_snip_m82.dx80.vtx")
resource.AddFile("models/tg/weaponsbetav1/M82/World_Model/w_tg_snip_m82.dx90.vtx")
resource.AddFile("models/tg/weaponsbetav1/M82/World_Model/w_tg_snip_m82.mdl")
resource.AddFile("models/tg/weaponsbetav1/M82/World_Model/w_tg_snip_m82.phy")	
resource.AddFile("models/tg/weaponsbetav1/M82/World_Model/w_tg_snip_m82.sw.vtx")
resource.AddFile("models/tg/weaponsbetav1/M82/World_Model/w_tg_snip_m82.vvd")
resource.AddFile("models/tg/weaponsbetav1/M82/World_Model/w_tg_snip_m82.xbox.vtx")
--End Models




SWEP.ViewModel 					= "models/tg/weaponsbetav1/M82/View_Model/v_tg_snip_m82.mdl"
SWEP.WorldModel 				= "models/tg/weaponsbetav1/M82/World_Model/w_tg_snip_m82.mdl"


And here’s an example of one of the .vmt’s from the textures, just in case:



VertexLitGeneric
{
	"$baseTexture" "tg\weaponsbetav1\M82\View_Model\Bipod"
	"$bumpmap" "tg\weaponsbetav1\M82\View_Model\Bipod_Norm"
}


Any ideas would be awesome.

Also, as per my previous post:

Thanks in advance,
Zeph

For your view model, you’ll want to add the underlined text to each $sequence for the animations, just before the fps:


$sequence you-know-what-sequence "you-know-what-sequence" ACT_VM_IDLE 1 **rotate -90** fps 30.00

From what I’ve noticed, the Source engine has a rather annoying habit of rotating things when it shouldn’t. By adding rotate -90, it usually fixes it.

Nope, still either invisible or out of the field of view.

Try changing it to rotate -180. If that doesn’t work, try using rotate 90 instead.

Tried -90 again after 90 was backwards, it worked. It mustn’t have downloaded properly the first time. Thanks Katra.