Player.GetViewModel

From GMod Wiki

Revision as of 19:14, 2 November 2009 by Crazy Quebecer (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax Player.GetViewModel( )
Description:
Returns the player's view model entity
Returns: Entity
In Object: Player
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Player.GetViewModel]Player.GetViewModel [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionThis gets the position and angle of the ejection port attachment of the local player's viewmodel.
Used onNewerClient.png
Code
 
 
	local ViewModel = LocalPlayer():GetViewModel()
	if not ViewModel:IsValid() then return end
 
	self.EjectionPort = ViewModel:GetAttachment("2")
	if not self.EjectionPort then return end
 
	self.Angle = self.EjectionPort.Ang
	self.Forward = self.Angle:Forward()
	self.Position = self.EjectionPort.Pos
 
 
 
OutputN/A
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox