gui.ScreenToVector
From GMod Wiki
Function | |
Syntax | gui.ScreenToVector( Integer x, Integer y ) |
Description: | |
Converts the specified screen position to a vector. | |
Returns: | Vector |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Gui.ScreenToVector]Gui.ScreenToVector [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Example
Description | This will convert the mouse position to a vector and print it. |
---|---|
Used on | |
Code | print( gui.ScreenToVector( gui.MousePos() ) ) |
Output | N/A |
Additional Notes
- This assumes you want to use the local player's screen, with the local player's camera. A version of this function that can be used with a custom screen / camera can be found here.
- This can be used to do a trace from the mouse position to the world
- This returns a normalized vector direction, not world coordinates.