Page 1 of 1

Compiled model positioning

PostPosted: Thu May 02, 2013 10:51 pm
by Goonie
I made a model that will replace sniper rifle in L4D 2. I got .qc file from the guy who compiled sniper rifle with it too. I changed a bit that .qc so it compile my model and find my textures, however Im getting problem like in pictures bellow. Weapon model is somehow positioned wrong.

Thirdperson view
Image

Firstperson view
Image

Heres .qc file:
Code: Select all
$cd "C:\sg mdls\vqc"
$origin 0 0 0 -90
$modelname "v_models\v_sniper_military.mdl"
$include "sharedbones.qci"   
$model "main" "mattock.smd"

$poseparameter ver_aims -1.00 1.00
$poseparameter move_x -0.50 0.50

$cdmaterials "models\mattock\"

$hboxset "default"
$hbox 0 "ValveBiped.Bip01" 0.000  0.000  -0.018  20.239  17.853  4.890

$attachment "attach_shell_eject" "weaponpart_ie" 0.00 -23.80 1.95 rotate -0.00 -90.00 0.00
$attachment "attach_muzzle" "weaponpart_ie" 0.00 -23.80 1.95 rotate -0.00 -90.00 0.00
$attachment "muzzle_flash" "weaponpart_ie" 0.00 -23.80 1.95 rotate -0.00 -90.00 0.00
//$attachment "flashlight" "weaponpart_ie" -1.25 -18.50 2.25 rotate -0.00 -90.00 0.00 // ez_jamin
$attachment "flashlight" "weaponpart_ie" -1.34 -16.85 2.35 rotate -0 -90 0 // FAS
$attachment "shell" "weaponpart_ie" 0.00 1.00 2.20 rotate -25.00 -155.00 0.00
$attachment "attach_camera" "ValveBiped.attach_camera" -0.00 0.00 0.00 rotate -0.00 0.00 0.00
$attachment "camera" "ValveBiped.Camera" 0.00 0.00 -0.00 rotate -0.00 0.00 0.00
$attachment "fowardnode" "weaponpart_ie" 0.00 0.00 0.00 rotate -0.00 -90.00 0.00
$include "bonesaver_attachments.qci"

$surfaceprop "default"
$illumposition -0.000 7.307 -31.193

$animation idle_delta "idle.smd" fps 0.0435

$animation look_down "look_down" fps 30.000000 subtract idle_delta 0
$animation look_mid "look_mid" fps 30.000000 subtract idle_delta 0
$animation look_up "look_up" fps 30.000000 subtract idle_delta 0
$sequence look_poses "look_up" fps 30.00 node Ready {
  blendwidth 3
  blend ver_aims -1.000000 1.000000
  delta
 look_mid look_down
}

$sequence idle_raw "idle_raw" loop fps 30.00 node Ready
$animation ta_trans_run "ta_trans_run" loop fps 40.000000
$animation ta_trans_idle "ta_trans_idle" loop fps 30.000000
$sequence idle "idle" loop ACT_VM_IDLE 1 fps 10.00 node Ready {
  blendwidth 3
  blend move_x -0.500000 0.500000
 ta_trans_idle ta_trans_run
  //addlayer look_poses
}

//$sequence deploy "deploy" ACT_VM_DEPLOY 1 fps 30.00 node Drawgun
$sequence deploy_layer "deploy" ACT_VM_DEPLOY_LAYER 1 fps 30.00 subtract idle_delta 0 node Drawgun {
 delta
  { event 5004 1 "Sniper_Military.Deploy" }
  { event 5004 12 "Sniper_Military.Pushbutton" }
}

//$sequence fire "fire" ACT_VM_PRIMARYATTACK 1 fps 30.00 node Bang
$sequence fire_layer "fire" ACT_VM_PRIMARYATTACK_LAYER 1 fps 30.00 subtract idle_delta 0 node Bang {
 delta
  { event AE_MUZZLEFLASH 0 "1" }
  { event AE_CL_CREATE_PARTICLE_EFFECT 0 "muzzle_lee_sniper follow_attachment muzzle_flash" }
  { event AE_CL_CREATE_PARTICLE_EFFECT 0 "muzzle_fire_sniper follow_attachment muzzle_flash" }
  { event AE_CL_CREATE_PARTICLE_BRASS 1 "weapon_shell_casing_rifle shell" }
}

$sequence reload_raw "reload" fadein 0.1 fps 25.00 node Rld {
}
$sequence fire_raw "fire" fps 30.00 node Bang {
  { event AE_MUZZLEFLASH 0 "1" }
  { event AE_CL_CREATE_PARTICLE_EFFECT 0 "muzzle_lee_sniper follow_attachment muzzle_flash" }
  { event AE_CL_CREATE_PARTICLE_EFFECT 0 "muzzle_fire_sniper follow_attachment muzzle_flash" }
  { event AE_CL_CREATE_PARTICLE_BRASS 1 "weapon_shell_casing_rifle shell" }
}

$sequence reload "reload" ACT_VM_RELOAD 1 fadein 0.1 fps 25.00 node Rld
$sequence reload_layer "reload" ACT_VM_RELOAD_LAYER 1 fadein 0.1 fps 25.00 subtract idle_delta 0 node Rld {
 delta
  { event 5004 0 "Sniper_Military.Deploy" }
  { event 5004 25 "Sniper_Military.ClipOut" }
  { event 5004 36 "Sniper_Military.ClipIn" }
  { event 5004 43 "Sniper_Military.ClipLocked" }
  { event 5004 59 "Sniper_Military.BoltBack" }
  { event 5004 68 "Sniper_Military.BoltForward" }
}

//$sequence melee "melee" ACT_VM_MELEE 1 fps 30.00 node Bash
$sequence melee_layer "melee" ACT_VM_MELEE_LAYER 1 fps 30.00 subtract idle_delta 0 node Bash {
 delta
}

Re: Compiled model positioning

PostPosted: Fri May 03, 2013 12:20 am
by Black_Stormy
Are you editing this in a 3d package or just recompiling from .smd files? This would be easiest to rectify in a 3d package since you could just rotate and reposition the model relative to the bones and (hopefully) that would fix it.

If you want to go about it the hard way, you're going to have to fiddle with the $origin line in your .qc to move it, and rotate it on the z axis - https://developer.valvesoftware.com/wiki/$origin

Although it looks to me like your model is on its side? In that case you're going to need to rotate around more than just the z axis, I recommend you get it into a 3d program to fix it. If you use blender I can help, not sure about the rest.

Re: Compiled model positioning

PostPosted: Fri May 03, 2013 12:34 pm
by Goonie
I will try to change the origin like you said and also the rotation on atachments. I will give an answer later if it help.

Re: Compiled model positioning

PostPosted: Fri May 03, 2013 9:34 pm
by Goonie
I changed model positions in 3d modeling program to same position as original from game and thirdpeson view now work, however in firstperson, model is missing. I cheked original model and it worked in game, but with my model dissapear.

Re: Compiled model positioning

PostPosted: Fri May 03, 2013 10:42 pm
by LordDz
Er.. Source uses separate models for first person and thirdperson/the player model.

Re: Compiled model positioning

PostPosted: Fri May 03, 2013 11:15 pm
by Goonie
LordDz wrote:Er.. Source uses separate models for first person and thirdperson/the player model.


I used difirent models for firstperson and thirdperson view. I mean I changed the position in 3d modeling program. Problem is that firstperson model is in the same position as original model was and it doesnt work in game.

Re: Compiled model positioning

PostPosted: Sat May 04, 2013 2:32 am
by Black_Stormy
You have to make sure it's rigged to the bones properly. If you move it in your 3d program you have to move it relative to the armature so that the whole bone structure isn't moved. It's a bit complex but there are tutorials out there for viewmodels.

Re: Compiled model positioning

PostPosted: Sat May 04, 2013 7:39 pm
by Goonie
Well acording to "Compiling L4D2 First-Person Weapon Models" tutorial on some site, theres no need for that Black_stormy.