Player.ViewPunch
From GMod Wiki
Function | |
Syntax |
Player.ViewPunch( Angle aPunch ) Where is this used? |
Description: | |
Shifts the player's view by the given angles (as if he had just been punched or thrown by a recoiling weapon). It will return to normal shortly afterwards (around a second later). | |
Returns: | nil |
Part of Library: | Player |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Player.ViewPunch]Player.ViewPunch [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Example
Description | This is how you would use it for a common SWEP |
---|---|
Used on | |
Code | self.Owner:ViewPunch( Angle( -5, 0, 0 ) ) // This is what you would use for a SWEP viewpunch. |
Output | None |
Additional Notes
- Although this hook is shared, it appears to have no effect when run client-side. Works fine server-side, however.
- Note that ViewPunch will not affect the aiming of a weapon from the cs weapon base and only the direction that the player is looking.
- The angle you give this function will shift the player's view a different direction depending on what numbers you give it. For example:
- Angle(-10,0,0) will shift the player's view upwards.
- Angle(10,0,0) will shift the player's view downwards.
- Angle(0,-10,0) will shift the player's view right.
- Angle(0,10,0) will shift the player's view left.
- Angle(0,0,-10) will spin the player's view clockwise.
- Angle(0,0,10) will spin the player's view counter-clockwise.