Entity.GetAttachment
From GMod Wiki
| Function | |
| Syntax | Entity:GetAttachment( Integer attachmentID ) |
| Description: | |
| Returns the angle and position of an attachment point on a model. | |
| Returns: | Table :Angpos |
| In Object: | Entity |
| Realm: |
|
| BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Entity.GetAttachment]Entity.GetAttachment [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
| Description | Find where the Jeep's gun is and where it's pointing. |
|---|---|
| Used on | |
| Code | function getJeepGunPosAng(Jeep) local attachmentID=Jeep:LookupAttachment("gun_ref"); return Jeep:GetAttachment(attachmentID) end |
| Output | This function returns a table with the angles and position in the Angpos format. |
Additional Notes
- The attachment ID is not the attachment point name - You need to convert the attachment point name to an attachment ID with the Entity:LookupAttachment function (see See Also)