RedM Natives

GET_SCREEN_COORD_FROM_WORLD_COORD

Hash0xCB50D7AFCC8B0EC6
Runtime nameGetScreenCoordFromWorldCoord
NamespaceGRAPHICS
SideClient
NameOfficial
Docs
Since build1207
GTA V hash0x34E82F05DF2974F5

Signature

BOOL GET_SCREEN_COORD_FROM_WORLD_COORD(float worldX, float worldY, float worldZ, float* screenX, float* screenY);

Parameters

NameTypeDescription
worldXfloat—
worldYfloat—
worldZfloat—
screenXfloat*—
screenYfloat*—

Returns BOOL

Usage

Lua
local retval, screenX, screenY = GetScreenCoordFromWorldCoord(worldX, worldY, worldZ)

-- always works, by hash
local retval, screenX, screenY = Citizen.InvokeNative(0xCB50D7AFCC8B0EC6, worldX, worldY, worldZ, Citizen.PointerValueFloat(), Citizen.PointerValueFloat(), Citizen.ReturnResultAnyway())
JavaScript and C#
JavaScript
const [retval, screenX, screenY] = GetScreenCoordFromWorldCoord(worldX, worldY, worldZ);

// by hash
const [retval, screenX, screenY] = Citizen.invokeNative('0xCB50D7AFCC8B0EC6', worldX + 0.0000001, worldY + 0.0000001, worldZ + 0.0000001, Citizen.pointerValueFloat(), Citizen.pointerValueFloat(), Citizen.returnResultAnyway());
C#
var screenX = new OutputArgument();
var screenY = new OutputArgument();
bool retval = Function.Call<bool>((Hash)0xCB50D7AFCC8B0EC6, worldX, worldY, worldZ, screenX, screenY);
// screenX.GetResult<float>()
// screenY.GetResult<float>()
  • 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.

Sources

alloc8or RDR3 NativeDB

Something wrong or missing? Contribute a verified note — corrections ship through pull requests.