Player.GetViewModel

From GMod Wiki

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