getWorldFromScreenPosition | Multi Theft Auto: Wiki Skip to content

getWorldFromScreenPosition

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function allows you to retrieve the world position corresponding to a 2D position on the screen, at a certain depth.

Syntax

getWorldFromScreenPosition ( )

Code Examples

client

This example binds the local player's "i" key to a function that creates an explosion in the middle of the screen.

function explosion ()
local w, h = guiGetScreenSize ()
local x, y, z = getWorldFromScreenPosition ( w/2, h/2, 10 )
createExplosion ( x, y, z, 11 )
end
bindKey ( "i", "down", explosion )

See Also

World Functions