{"hash":"0xC81D0659","ns":"CFX","name":"GET_WORLD_COORD_FROM_SCREEN_COORD","slug":"GET_WORLD_COORD_FROM_SCREEN_COORD","official":true,"named":true,"luaName":"GetWorldCoordFromScreenCoord","game":"cfx","apiset":"client","returnType":"void","params":[{"name":"screenX","type":"float","description":"A screen horizontal axis coordinate (0.0 - 1.0)."},{"name":"screenY","type":"float","description":"A screen vertical axis coordinate (0.0 - 1.0)."},{"name":"worldVector","type":"Vector3*","description":"The world coord vector pointer."},{"name":"normalVector","type":"Vector3*","description":"The screen normal vector pointer."}],"returnsDescription":"A Vector3 representing the world coordinates relative to the specified screen coordinates and a screen plane normal Vector3 (normalised).","summary":"Converts a screen coordinate into its relative world coordinate.","descriptions":[{"source":"cfx","format":"md","body":"Converts a screen coordinate into its relative world coordinate."}],"examples":[{"lang":"lua","code":"CreateThread(function()\n  while true do\n    local screenX = GetDisabledControlNormal(0, 239)\n    local screenY = GetDisabledControlNormal(0, 240)\n\n    local world, normal = GetWorldCoordFromScreenCoord(screenX, screenY)\n\n    local depth = 10\n\n    local target = world + normal * depth\n\n    DrawSphere(target.x, target.y, target.z, 0.5, 255, 0, 0, 0.5)\n\n    Wait(0)\n  end\nend)","source":"cfx"}],"aliases":[],"enums":[],"related":[],"sources":["cfx"],"doc":3,"url":"https://natives.borderlinerp.com/natives/CFX/GET_WORLD_COORD_FROM_SCREEN_COORD","markdownUrl":"https://natives.borderlinerp.com/natives/CFX/GET_WORLD_COORD_FROM_SCREEN_COORD.md","snippets":{"lua":"local worldVector, normalVector = GetWorldCoordFromScreenCoord(screenX, screenY)","luaInvoke":"local worldVector, normalVector = Citizen.InvokeNative(0xc81d0659, screenX, screenY, Citizen.PointerValueVector(), Citizen.PointerValueVector())","js":"const [worldVector, normalVector] = GetWorldCoordFromScreenCoord(screenX, screenY);","jsInvoke":"const [worldVector, normalVector] = Citizen.invokeNative('0xc81d0659', screenX + 0.0000001, screenY + 0.0000001, Citizen.pointerValueVector(), Citizen.pointerValueVector());","csharp":"var worldVector = new OutputArgument();\nvar normalVector = new OutputArgument();\nFunction.Call((Hash)0xc81d0659, screenX, screenY, worldVector, normalVector);\n// worldVector.GetResult<Vector3>()\n// normalVector.GetResult<Vector3>()","notes":["Float parameters: Lua integers (`10`, or whole numbers decoded from NUI/JSON) are sent as ints and read as garbage. Write `10.0` or `value + 0.0`. The generated JS wrappers add `0.0000001` to non-zero floats for the same reason.","Pointer (out) arguments are not passed in Lua/JS: their values are returned after the result, in order."]}}