The Lab
GRAPHICS native

GET_SCREEN_COORD_FROM_WORLD_COORD

returns BOOL5 paramsbuild 1207

Projects a world position to normalized screen coordinates, writing them to screenX and screenY and returning true if the point is on screen.

Commonly used to draw 3D text above objects.

Signature

C
BOOL GET_SCREEN_COORD_FROM_WORLD_COORD(float worldX, float worldY, float worldZ, float* screenX, float* screenY); // 0xCB50D7AFCC8B0EC6 b1207

Parameters

#NameType
1worldXfloat
2worldYfloat
3worldZfloat
4screenXfloat* (out pointer)
5screenYfloat* (out pointer)

Facts

Facts about GET_SCREEN_COORD_FROM_WORLD_COORD
Name
GET_SCREEN_COORD_FROM_WORLD_COORD
Hash
0xCB50D7AFCC8B0EC6
Namespace
Returns
BOOL
Game build
1207

Examples

Calls by hash work in every RedM runtime. Replace the placeholder arguments with your own values.

Lua
local result, screenX, screenY = Citizen.InvokeNative(0xCB50D7AFCC8B0EC6, -- GET_SCREEN_COORD_FROM_WORLD_COORD
  0.0, -- float worldX
  0.0, -- float worldY
  0.0, -- float worldZ
  Citizen.PointerValueFloat(), -- float* screenX
  Citizen.PointerValueFloat(), -- float* screenY
  Citizen.ReturnResultAnyway()
)
if result then
  -- ...
end
JavaScript
// Whole JS numbers are sent as integers: pass floats like 1.5 (or n + 0.0000001), never 1.
const [result, screenX, screenY] = Citizen.invokeNative("0xCB50D7AFCC8B0EC6", // GET_SCREEN_COORD_FROM_WORLD_COORD
  0.0, // float worldX
  0.0, // float worldY
  0.0, // float worldZ
  Citizen.pointerValueFloat(), // float* screenX
  Citizen.pointerValueFloat(), // float* screenY
  Citizen.returnResultAnyway()
);
if (result) {
  // ...
}
C#
var screenXArg = new OutputArgument();
var screenYArg = new OutputArgument();
bool result = Function.Call<bool>((Hash)0xCB50D7AFCC8B0EC6, // GET_SCREEN_COORD_FROM_WORLD_COORD
  0.0f, // float worldX
  0.0f, // float worldY
  0.0f, // float worldZ
  screenXArg, // float* screenX
  screenYArg // float* screenY
);
float screenX = screenXArg.GetResult<float>();
float screenY = screenYArg.GetResult<float>();
All GRAPHICS natives

Facts compiled from community research (alloc8or/rdr3-nativedb-data, femga/rdr3_discoveries); descriptions and examples by The Lab.