GET_WORLD_COORD_FROM_SCREEN_COORD
Converts a screen coordinate into its relative world coordinate.
CFX
Signature
lua
GetWorldCoordFromScreenCoord(0.0, 0.0, worldVector, normalVector)
-- returns voidParameters
| Name | Type | Description |
|---|---|---|
| float | A screen horizontal axis coordinate (0.0 - 1.0). | |
| float | A screen vertical axis coordinate (0.0 - 1.0). | |
| Vector3* | The world coord vector pointer. | |
| Vector3* | The screen normal vector pointer. |
Usage
Named call
GetWorldCoordFromScreenCoord(0.0, 0.0, worldVector, normalVector)InvokeNative
Citizen.InvokeNative(0xC81D0659, 0.0, 0.0, worldVector, normalVector)lua 1
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)Details
- Hash
- API set
- Source
- cfx
Source: cfx
