Screen position to world vector

-edited out

Okay scrap that shit, i have a workaround that works just as well.

[lua]
local endpoint = self.Owner:GetShootPos() + self.Owner:GetAimVector() * AimDist
local rspread, lspread = Vector( scale, 0, 0 ), Vector( -scale, 0, 0 )
local leftend = self.Owner:GetShootPos() + ( self.Owner:GetAimVector() + lspread ) * AimDist
local rightend = self.Owner:GetShootPos() + ( self.Owner:GetAimVector() + rspread ) * AimDist

local left, right = leftend:ToScreen(), rightend:ToScreen()
local endp = endpoint:ToScreen()

surface.SetDrawColor( 250, 250, 250, 250 )
surface.DrawRect( left.x, left.y, 5, 5 )
surface.DrawRect( right.x, right.y, 5, 5 )

surface.SetDrawColor( 20, 250, 250, 250 )
surface.DrawRect( endp.x, endp.y, 5, 5 )[/lua]

It has one minor problem

Shouldn’t it be

[lua]
local aim = self.Owner:GetAimVector()
local endpoint = self.Owner:GetShootPos() + aim * AimDist
local leftend = endpoint + aim:Angle():Right() * -scale
local rightend = endpoint + aim:Angle():Right() * scale

local left, right = leftend:ToScreen(), rightend:ToScreen()
local endp = endpoint:ToScreen()

surface.SetDrawColor( 250, 250, 250, 250 )
surface.DrawRect( left.x, left.y, 5, 5 )
surface.DrawRect( right.x, right.y, 5, 5 )

surface.SetDrawColor( 20, 250, 250, 250 )
surface.DrawRect( endp.x, endp.y, 5, 5 )

[/lua]