ViewModel hovers above player

Hi! I decompiled the tool gun to get an example ViewModel. I added my mesh and rigged it to one of the fingers (it’s a ring), and after setting up my LUA and everything, the ViewModel appears to hover above the player in third-person and I can’t see it at all in first-person.

What’s the cause of this? Here’s the QC:



$ModelName "weapons/ring.mdl"
$BodyGroup "studio"
{
	studio "weapon_reference.smd"
}

$SurfaceProp "default"
$Contents "solid"
$CDMaterials "models\Weapons\V_hand\"
$Attachment "muzzle" "muzzle" 0 0 0 rotate -90 90 0
$CBox 0 0 0 0 0 0
$BBox -4.488 -12.171 -17.396 30.017 5.724 -0.664

$Sequence "idle01" {
	"weapon_reference.smd"
	activity "ACT_VM_IDLE" 1
	fadein 0.2
	fadeout 0.2
	node "Ready"
	fps 30
	loop
}


bump, need halp

It looks like you replaced the worldmodel of the toolgun with the viewmodel. Can you post the model file along with your code?

I did this to be able to see it, I can’t see it in viewmodel mode. Here are the files: https://ufile.io/hluec

Okay I made a minimum requirements SWEP, viewmodel from a playermodel, just removed the mesh except arms

The problem I have now (and that also is the original problem) is that the SWEP will have whatever Y position i have in my 3D modeler software, as opposed to setting it based off of the QC

I feel like I’m missing some important line in the QC that aligns the correct Y position

Here’s my rig setup:

Here’s my QC



$ModelName "weapons\v_zombie.mdl"

$BodyGroup "studio"
{
	studio "v_zombie.smd"
}

$SurfaceProp "default"

$Contents "solid"

$CDMaterials "models\Humans\Male\Group01\"
$CDMaterials "models\Humans\Male\"
$CDMaterials "models\humans\male\"

//$Attachment "1" "muzzleflash" 0 0 0 rotate 0 0 0
//$Attachment "2" "ejection" 0 0 0 rotate -90 0 0

$CBox 0 0 0 0 0 0
$BBox -10.383 -15.877 -17.982 16.419 11.104 5.601

//$DefineBone "muzzleflash" "" 2.475316 -12.685506 -2.23814 0 89.999983 90.000037 0 0 0 0 0 0
$definebone "base" "" 0.000000 0.000000 0.000000 -0.000000 0.000000 90.000004 0.000000 0.000000 0.000000 -0.000000 0.000000 0.000000
$definebone "ValveBiped.Bip01_Spine4" "base" 0.000005 1.053917 -3.336145 -10.250023 89.999990 89.999983 0.000000 0.000000 0.000000 -0.000000 -0.000000 0.000000
$definebone "ValveBiped.Bip01_R_Clavicle" "ValveBiped.Bip01_Spine4" 2.033356 1.000773 -1.937610 73.712051 168.618794 -95.596517 0.000000 0.000000 0.000000 -0.000000 0.000000 -0.000001
$definebone "ValveBiped.Bip01_R_UpperArm" "ValveBiped.Bip01_R_Clavicle" 6.028145 -0.000004 -0.000000 78.538878 131.373144 -143.554623 -0.000000 0.000000 0.000000 0.000001 0.000000 0.000001
$definebone "ValveBiped.Bip01_R_Forearm" "ValveBiped.Bip01_R_UpperArm" 11.692551 0.000000 0.000008 -0.000057 -3.459061 0.000001 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
$definebone "ValveBiped.Bip01_R_Hand" "ValveBiped.Bip01_R_Forearm" 11.481706 -0.000001 0.000011 6.108018 2.532073 -89.664286 0.000000 0.000000 0.000000 -0.000000 0.000001 -0.000001
$definebone "ValveBiped.Bip01_L_Clavicle" "ValveBiped.Bip01_Spine4" 2.033348 1.000769 1.937660 -73.711826 168.619245 91.480563 0.000000 -0.000000 0.000000 -0.000000 -0.000002 -0.000000
$definebone "ValveBiped.Bip01_L_UpperArm" "ValveBiped.Bip01_L_Clavicle" 6.028146 -0.000004 0.000000 -85.060773 127.754018 137.955029 0.000000 0.000000 0.000000 -0.000001 0.000000 0.000000
$definebone "ValveBiped.Bip01_L_Forearm" "ValveBiped.Bip01_L_UpperArm" 11.692558 0.000000 -0.000004 -0.000001 -3.459060 0.000000 0.000000 0.000000 0.000000 -0.000001 0.000000 0.000000
$definebone "ValveBiped.Bip01_L_Hand" "ValveBiped.Bip01_L_Forearm" 11.481675 0.000001 -0.000034 -6.108475 2.532072 90.136751 0.000000 0.000000 0.000000 -0.000000 0.000001 0.000003
$definebone "ValveBiped.Bip01_R_Finger1" "ValveBiped.Bip01_R_Hand" 3.871262 0.106621 -1.301835 1.676589 -26.589365 -20.195959 0.000000 0.000000 0.000001 -0.000000 0.000001 0.000002
$definebone "ValveBiped.Bip01_R_Finger11" "ValveBiped.Bip01_R_Finger1" 1.719433 -0.000004 -0.000002 -0.443296 -20.795677 -0.000055 0.000000 0.000000 0.000000 0.000002 -0.000003 0.000002
$definebone "ValveBiped.Bip01_R_Finger12" "ValveBiped.Bip01_R_Finger11" 1.099661 0.000000 -0.000002 -0.282409 -13.997076 -0.000056 0.000001 0.000000 0.000000 0.000001 -0.000006 0.000002
$definebone "ValveBiped.Bip01_R_Finger0" "ValveBiped.Bip01_R_Hand" 0.838804 -0.311184 -1.310237 38.062158 -41.541044 71.507082 0.000000 0.000000 0.000000 0.000003 0.000002 0.000000
$definebone "ValveBiped.Bip01_R_Finger01" "ValveBiped.Bip01_R_Finger0" 1.789788 -0.000002 0.000000 0.187874 13.098734 0.000059 0.000000 0.000000 0.000000 0.000001 0.000000 0.000001
$definebone "ValveBiped.Bip01_R_Finger02" "ValveBiped.Bip01_R_Finger01" 1.207007 -0.000001 -0.000004 0.287053 20.798024 0.000002 0.000000 0.000000 0.000000 0.000002 -0.000003 0.000002
$definebone "ValveBiped.Bip01_R_Ulna" "ValveBiped.Bip01_R_Forearm" 5.740851 0.000000 0.000004 -0.000057 -0.000002 0.263561 0.000000 0.000000 0.000000 -0.000000 -0.000002 -0.000001
$definebone "ValveBiped.Bip01_R_Wrist" "ValveBiped.Bip01_R_Forearm" 11.481702 -0.000001 0.000011 -0.000057 -0.000002 0.487588 0.000000 0.000000 0.000000 0.000000 0.000000 0.000001
$definebone "ValveBiped.Bip01_R_Shoulder" "ValveBiped.Bip01_R_UpperArm" 1.500000 0.000001 -0.000008 0.000001 0.000000 0.000001 0.000000 0.000000 0.000000 0.000001 0.000000 0.000001
$definebone "ValveBiped.Bip01_R_Bicep" "ValveBiped.Bip01_R_UpperArm" 5.559998 0.000000 -0.000004 0.000001 0.000000 0.000001 0.000000 0.000000 0.000000 0.000001 0.000000 0.000001
$definebone "ValveBiped.Bip01_R_Elbow" "ValveBiped.Bip01_R_UpperArm" 11.692557 0.000000 -0.000000 0.000001 -1.690225 0.000000 0.000000 0.000000 0.000000 0.000001 0.000000 0.000000
$definebone "ValveBiped.Bip01_R_Trapezius" "ValveBiped.Bip01_R_Clavicle" 5.166962 -0.000004 0.000000 -0.000000 0.000000 -0.000001 0.000000 0.000000 0.000000 -0.000000 0.000000 -0.000001
$definebone "ValveBiped.Bip01_R_Finger2" "ValveBiped.Bip01_R_Hand" 3.881348 0.211365 -0.402027 -2.049069 -29.776733 -5.025815 0.000000 -0.000001 0.000000 -0.000000 0.000000 0.000000
$definebone "ValveBiped.Bip01_R_Finger21" "ValveBiped.Bip01_R_Finger2" 1.719584 -0.000001 0.000000 -0.434531 -20.995700 -0.000000 0.000000 0.000000 0.000000 0.000001 -0.000007 -0.000000
$definebone "ValveBiped.Bip01_R_Finger22" "ValveBiped.Bip01_R_Finger21" 1.209179 0.000002 0.000000 -0.242991 -12.397668 -0.000001 -0.000001 0.000000 0.000000 0.000001 -0.000008 -0.000001
$definebone "ValveBiped.Bip01_L_Finger2" "ValveBiped.Bip01_L_Hand" 3.881376 0.214691 0.400259 1.812898 -29.791055 5.025245 0.000000 0.000001 0.000000 0.000002 0.000000 0.000003
$definebone "ValveBiped.Bip01_L_Finger21" "ValveBiped.Bip01_L_Finger2" 1.719574 0.000005 0.000000 0.286769 -20.998102 0.000002 0.000000 0.000000 0.000000 0.000004 -0.000001 0.000003
$definebone "ValveBiped.Bip01_L_Finger22" "ValveBiped.Bip01_L_Finger21" 1.209173 -0.000002 -0.000000 0.160318 -12.399035 0.000002 0.000000 0.000000 0.000000 0.000003 -0.000003 0.000001
$definebone "ValveBiped.Bip01_L_Finger1" "ValveBiped.Bip01_L_Hand" 3.871296 0.117424 1.300905 -1.889327 -26.576533 20.194873 0.000000 0.000001 0.000000 0.000003 0.000002 0.000002
$definebone "ValveBiped.Bip01_L_Finger11" "ValveBiped.Bip01_L_Finger1" 1.719433 -0.000004 -0.000003 0.292612 -20.798194 0.000000 0.000000 -0.000002 0.000000 0.000003 -0.000000 0.000001
$definebone "ValveBiped.Bip01_L_Finger12" "ValveBiped.Bip01_L_Finger11" 1.099663 0.000002 -0.000001 0.186501 -13.998734 0.000000 0.000001 -0.000002 0.000000 0.000004 0.000001 0.000000
$definebone "ValveBiped.Bip01_L_Finger0" "ValveBiped.Bip01_L_Hand" 0.838833 -0.300278 1.312777 -38.376709 -41.260579 -71.677536 0.000000 0.000000 0.000000 -0.000006 0.000009 0.000002
$definebone "ValveBiped.Bip01_L_Finger01" "ValveBiped.Bip01_L_Finger0" 1.789784 0.000002 0.000001 -0.123707 13.099488 0.000001 0.000000 0.000000 -0.000001 -0.000004 0.000014 0.000000
$definebone "ValveBiped.Bip01_L_Finger02" "ValveBiped.Bip01_L_Finger01" 1.207001 0.000000 -0.000001 -0.189081 20.799186 -0.000001 0.000000 0.000000 0.000000 -0.000004 0.000012 -0.000002
$definebone "ValveBiped.Bip01_L_Ulna" "ValveBiped.Bip01_L_Forearm" 5.740849 0.000000 0.000000 -0.000001 0.000000 -0.031170 0.000000 -0.000000 0.000000 -0.000001 0.000000 0.000002
$definebone "ValveBiped.Bip01_L_Wrist" "ValveBiped.Bip01_L_Forearm" 11.481698 0.000000 -0.000004 -0.000001 0.000000 -0.057580 0.000000 0.000000 0.000000 -0.000001 0.000000 0.000000
$definebone "ValveBiped.Bip01_L_Elbow" "ValveBiped.Bip01_L_UpperArm" 11.692553 0.000001 -0.000004 -0.000001 -1.690226 0.000002 0.000000 0.000000 0.000000 -0.000001 0.000000 0.000002
$definebone "ValveBiped.Bip01_L_Shoulder" "ValveBiped.Bip01_L_UpperArm" 1.499996 -0.000000 -0.000004 -0.000001 0.000000 0.000000 0.000000 0.000000 0.000000 -0.000001 0.000000 0.000000
$definebone "ValveBiped.Bip01_L_Bicep" "ValveBiped.Bip01_L_UpperArm" 5.559998 0.000000 0.000000 -0.000001 0.000000 0.000000 0.000000 0.000000 0.000000 -0.000001 0.000000 0.000000
$definebone "ValveBiped.Bip01_L_Trapezius" "ValveBiped.Bip01_L_Clavicle" 5.166964 -0.000004 0.000000 -0.000000 -0.000002 -0.000000 0.000000 0.000000 0.000000 -0.000000 -0.000002 -0.000000

$Sequence IDLE2 "v_zombie.smd" ACT_VM_IDLE 1 FPS 1
$Sequence IDLE02 "v_zombie.smd" ACT_VM_IDLE 1 FPS 1
$Sequence IDLE1 "v_zombie.smd" ACT_VM_IDLE 1 FPS 1
$Sequence IDLE01 "v_zombie.smd" ACT_VM_IDLE 1 FPS 1
$Sequence IDLE "v_zombie.smd" ACT_VM_IDLE 1 FPS 1
$Sequence RefTall "v_zombie.smd" ACT_REFTALL 1 FPS 1
$Sequence Reference "v_zombie.smd" ACT_REFERENCE 1 FPS 1 

$IKChain "rhand" "ValveBiped.Bip01_R_Hand" knee 0.707 0.707 0
$IKChain "lhand" "ValveBiped.Bip01_L_Hand" knee 0.707 0.707 0


Is anyone here able to shed some light on this? I’m very curious about viewmodels

The way I learned it was just that the first person camera was always at 0,0,0 and the model should be positioned accordingly. Is there a reason that you can’t just move your view model down?

I can, yes. Can’t find any information about how people did this though. Appreciate it

Oh it’s just like you said. I don’t know of any QC command or anything, I just always move it down in Blender with the transform tool.

Is there some reason that you can’t just move it down in your 3D application? Are all the animations done above the origin? If that’s the case you can parent the model to an empty object and move it into position, then apply the object transforms on the empty object, that way you won’t have to redo the animations/move the root bone for every single one.

I can move it fine, I just though you set it with a QC line

You might be able to use $origin 0 0 0 in your QC. By adding it to your QC you can reposition your viewmodel by editing the 0 values.

https://developer.valvesoftware.com/wiki/$origin

Just try and play around with the values and see what it gives you.