GET_HUD_SCREEN_POSITION_FROM_WORLD_POSITION
Projects the world position (worldX, worldY, worldZ) to screen space, writing normalized coordinates into screenX and screenY. Returns an integer status.
Signature
int GET_HUD_SCREEN_POSITION_FROM_WORLD_POSITION(float worldX, float worldY, float worldZ, float* screenX, float* screenY); // 0xB39C81628EF10B42 b1207Parameters
| # | Name | Type |
|---|---|---|
| 1 | worldX | float |
| 2 | worldY | float |
| 3 | worldZ | float |
| 4 | screenX | float* (out pointer) |
| 5 | screenY | float* (out pointer) |
Facts
| 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.
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)// 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)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>();Related HUD natives
- GET_CHARACTER_FROM_AUDIO_CONVERSATION_FILENAME
- GET_STRING_FROM_HASH_KEY
- _GET_COLOR_FROM_NAME
- _GET_HUD_VISIBILITY_SLOT_STATE
- _HUD_GET_INVENTORY_WHEEL_CURRENTLY_HIGHLIGHTED
- GET_FILENAME_FOR_AUDIO_CONVERSATION
- GET_LENGTH_OF_LITERAL_STRING
- GET_LENGTH_OF_LITERAL_STRING_IN_BYTES
- GET_NAMED_RENDERTARGET_RENDER_ID
- _DISABLE_HUD_CONTEXT
- _ENABLE_HUD_CONTEXT
- _ENABLE_HUD_CONTEXT_THIS_FRAME
Facts compiled from community research (alloc8or/rdr3-nativedb-data, femga/rdr3_discoveries); descriptions and examples by The Lab.