The Lab
HUD native

GET_HUD_SCREEN_POSITION_FROM_WORLD_POSITION

returns int5 paramsbuild 1207

Projects the world position (worldX, worldY, worldZ) to screen space, writing normalized coordinates into screenX and screenY. Returns an integer status.

Signature

C
int GET_HUD_SCREEN_POSITION_FROM_WORLD_POSITION(float worldX, float worldY, float worldZ, float* screenX, float* screenY); // 0xB39C81628EF10B42 b1207

Parameters

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

Facts

Facts about GET_HUD_SCREEN_POSITION_FROM_WORLD_POSITION
Name
GET_HUD_SCREEN_POSITION_FROM_WORLD_POSITION
Hash
0xB39C81628EF10B42
Namespace
Returns
int
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(0xB39C81628EF10B42, -- GET_HUD_SCREEN_POSITION_FROM_WORLD_POSITION
  0.0, -- float worldX
  0.0, -- float worldY
  0.0, -- float worldZ
  Citizen.PointerValueFloat(), -- float* screenX
  Citizen.PointerValueFloat(), -- float* screenY
  Citizen.ResultAsInteger()
)
print(result, screenX, screenY)
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("0xB39C81628EF10B42", // GET_HUD_SCREEN_POSITION_FROM_WORLD_POSITION
  0.0, // float worldX
  0.0, // float worldY
  0.0, // float worldZ
  Citizen.pointerValueFloat(), // float* screenX
  Citizen.pointerValueFloat(), // float* screenY
  Citizen.resultAsInteger()
);
console.log(result, screenX, screenY)
C#
var screenXArg = new OutputArgument();
var screenYArg = new OutputArgument();
int result = Function.Call<int>((Hash)0xB39C81628EF10B42, // GET_HUD_SCREEN_POSITION_FROM_WORLD_POSITION
  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 HUD natives

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