Garry's Mod Wiki

Entity:GetAttachment

table Entity:GetAttachment( number attachmentId )

Description

Gets the orientation and position of the attachment by its ID, returns nothing if the attachment does not exist.

The update rate of this function is limited by the setting of ENT.AutomaticFrameAdvance for Scripted Entities!
This will return improper values for viewmodels if used in GM:CalcView.

Arguments

1 number attachmentId
The internal ID of the attachment.

Returns

1 table
The angle and position of the attachment. See the Structures/AngPos. Most notably, the table contains the keys "Ang" and "Pos".

Example

Grabs the muzzle position of a player's view model

local vm = ply:GetViewModel() local obj = vm:LookupAttachment( "muzzle" ) local muzzlepos = vm:GetAttachment( obj )

Page Links


Special Pages


Wikis

?

Render Time: 32ms

Session 0
DB GetPage 2
Generate Html 8
SaveChanges 8
Render Body 0
Render Sidebar 11