Scripting/Client/Functions/ScreenPosToWorld
Two arguments: the world point on the ground plane (z = 0) under a screen pixel as {x, y, z}, or null for sky. Three arguments (v0.2.4+, original LU form): the point on that pixel's ray depth in front of the camera - depth 0 is the camera position, so ScreenPosToWorld(0, 0, 0) reads where the camera is. A VectorScreen can replace x, y.
Syntax
ScreenPosToWorld(x, y)ScreenPosToWorld(x, y, depth)Arguments
- float x
- float y
- any depth – Three arguments (v0.2.4+, original LU form): the point on that pixel's ray
depthin front of the camera - depth 0 is the camera position, soScreenPosToWorld(0, 0, 0)reads where the camera is.
Example
function onScriptLoad()
{
local pos = player.Pos;
ScreenPosToWorld( pos.x, pos.y );
}This sample was generated from the signature – adapt the values to your gamemode.
Related pages
- GetScreenWidth
- WorldPosToScreen
- GetGroundZLevel
- GetGroundZLevelForPos
- GetGroundZLevelForPosLoad
- Draw3DText
- Draw3DSprite
- Draw3DTextWorld
- Draw3DSpriteWorld
- SetCameraMatrix
- SetCameraTarget
- RestoreCamera
Section: Screen, world and camera
Categories: Client functions | Screen, world and camera