RedM Index logoRedM Index
NativesHashesClothesBlipsPropsItem Tool
Sign inGet started

Reference

  • Natives
  • Hashes
  • Clothes
  • Blips
  • Props

Namespace

  1. Reference
  2. Natives
  3. GET_WORLD_COORD_FROM_SCREEN_COORD

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 void

Parameters

NameTypeDescription
floatA screen horizontal axis coordinate (0.0 - 1.0).
floatA 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

On this page

  • Signature
  • Parameters
  • Usage
  • Details