Garry's Mod Wiki


  Vector, Angle WEAPON:CalcViewModelView( Entity ViewModel, Vector OldEyePos, Angle OldEyeAng, Vector EyePos, Angle EyeAng )


Allows overriding the position and angle of the viewmodel. This hook only works if you haven't overridden GM:CalcViewModelView.


1 Entity ViewModel
The viewmodel entity
2 Vector OldEyePos
Original position (before viewmodel bobbing and swaying)
3 Angle OldEyeAng
Original angle (before viewmodel bobbing and swaying)
4 Vector EyePos
Current position
5 Angle EyeAng
Current angle


1 Vector
New position
2 Angle
New angle


One way to change the viewmodel texture (skin) for your SWEP. Changing it from 0 to 1.

Remember to define the base path ($cdmaterials) for your model when e.g. using Crowbar to compile .smd to .mdl; or else you won't get any texture(s) applied. (the game won't know where to look) QC Commands

And remember to use $texturegroup for multiple skins.

function SWEP:CalcViewModelView(ViewModel, OldEyePos, OldEyeAng, EyePos, EyeAng) -- Set skin to the SWEPs second skin; 1. Starts at 0 ViewModel:SetSkin(1) end