WEAPON/CalcViewModelView

From Garry's Mod
Jump to: navigation, search
 WEAPON:CalcViewModelView( )

Contents

Description

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

Arguments

Entity ViewModel

The viewmodel entity

Arguments

Vector OldEyePos

Original position (before viewmodel bobbing and swaying)

Arguments

Angle OldEyeAng

Original angle (before viewmodel bobbing and swaying)

Arguments

Vector EyePos

Current position

Arguments

Angle EyeAng

Current angle

Returns

Vector

New position

Returns

Angle

New angle

Examples

Example

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

Output:

Skin 0
Skin 1
Personal tools
Navigation