--  LUA  GetWorldCoordFromScreenCoord

0xC81D0659

-- GET_WORLD_COORD_FROM_SCREEN_COORD
local worldVector --[[ vector3 ]], normalVector --[[ vector3 ]] =
	GetWorldCoordFromScreenCoord(
		screenX --[[ number ]], 
		screenY --[[ number ]]
	)

Parameters:

    screenX:

    A screen horizontal axis coordinate (0.0 - 1.0).
    screenY:

    A screen vertical axis coordinate (0.0 - 1.0).
    worldVector:

    The world coord vector pointer.
    normalVector:

    The screen normal vector pointer.

Returns:

A Vector3 representing the world coordinates relative to the specified screen coordinates and a screen plane normal Vector3 (normalised).

Converts a screen coordinate into its relative world coordinate.

Examples:

    Lua

CreateThread(function()

  while true do

    local screenX = GetDisabledControlNormal(0, 239)

    local screenY = GetDisabledControlNormal(0, 240)



    local world, normal = GetWorldCoordFromScreenCoord(screenX, screenY)



    local depth = 10



    local target = world + normal * depth



    DrawSphere(target.x, target.y, target.z, 0.5, 255, 0, 0, 0.5)



    Wait(0)

  end

end)
 
 

Parameters:

header:

sentence.

header:

sentence.

header:

sentence.

Returns:

sentence.

Summary

sentence.

Example

---  
    


Additional natives used in this example, or natives commonly used with this native.

NATIVE, NATIVE

Common Errors or Problems

Problem: sentence.

Problem: sentence.

Problem: sentence.

Credits and Disclaimers

The base of this data was taken from the redm/cfx fivem/rdr docs, and vespura. We have been saving and making notes for two years now, and are now adding them to our site for everyone to use. We will be modifying the notes as needed, and building tutorials around the data so these pages will change as we work on it. This is a manual process, not an automated one, so updates will occur as we have time, the priority is releasing resources. Thanks for your patience.

Was the documentation useful?

Related Examples and Posts

Dragon Codes