ScreenToWorld

Returns the world position of a screen coordinate.

ScreenToWorld(x, y, hitFlags) : x, y, z

The x and y paramaters should be between -1 and 1, (0,0) being the center of the screen, (-1,1) being the bottom left.

Example

Sets the mouseover unit to the target.

local sx, sy = 0, 0
local hitFlags = bit.bor(0x1, 0x10, 0x100, 0x100000)
local x, y, z = ScreenToWorld(sx, sy, hitFlags)

Info

Hit Flags:

M2Collision = 0x1
M2Render = 0x2
WMOCollision = 0x10
WMORender = 0x20
Terrain = 0x100
WaterWalkableLiquid = 0x10000
Liquid = 0x20000
EntityCollision = 0x100000
Unknown = 0x200000