Garry's Mod Wiki

Garry's Mod Wiki

  Vector, Angle WEAPON:GetViewModelPosition( Vector EyePos, Angle EyeAng )

Description

This hook allows you to adjust view model position and angles.

Arguments

1 Vector EyePos
Current position
2 Angle EyeAng
Current angle

Returns

1 Vector
New position
2 Angle
New angle

Example

This moves and rotates the original viewmodel based on fixed offsets, changing its idle position in front of the player.

-- Adjust these variables to move the viewmodel's position SWEP.IronSightsPos = Vector(9.49, 10.5, -12.371) SWEP.IronSightsAng = Vector(12, 65, -22.19) function SWEP:GetViewModelPosition(EyePos, EyeAng) local Mul = 1.0 local Offset = self.IronSightsPos if (self.IronSightsAng) then EyeAng = EyeAng * 1 EyeAng:RotateAroundAxis(EyeAng:Right(), self.IronSightsAng.x * Mul) EyeAng:RotateAroundAxis(EyeAng:Up(), self.IronSightsAng.y * Mul) EyeAng:RotateAroundAxis(EyeAng:Forward(), self.IronSightsAng.z * Mul) end local Right = EyeAng:Right() local Up = EyeAng:Up() local Forward = EyeAng:Forward() EyePos = EyePos + Offset.x * Right * Mul EyePos = EyePos + Offset.y * Forward * Mul EyePos = EyePos + Offset.z * Up * Mul return EyePos, EyeAng end

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...