GET_SCREEN_COORD_FROM_WORLD_COORD
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
BOOL GET_SCREEN_COORD_FROM_WORLD_COORD(float worldX, float worldY, float worldZ, float* screenX, float* screenY); // 0xCB50D7AFCC8B0EC6 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_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.
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// 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) {
// ...
}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>();Related GRAPHICS natives
- GET_SCREEN_RESOLUTION
- GET_STATUS_OF_CREATE_LOW_QUALITY_COPY_OF_PHOTO
- GET_STATUS_OF_LOAD_MISSION_CREATOR_PHOTO
- GET_STATUS_OF_SAVE_HIGH_QUALITY_PHOTO
- GET_STATUS_OF_SORTED_LIST_OPERATION
- GET_STATUS_OF_TAKE_HIGH_QUALITY_PHOTO
- GET_TIMECYCLE_MODIFIER_INDEX
- GET_TIMECYCLE_TRANSITION_MODIFIER_INDEX
- GET_TOGGLE_PAUSED_RENDERPHASES_STATUS
- GET_TV_CHANNEL
- _ANIMPOSTFX_GET_STACKHASH
- _GET_CURRENT_NUMBER_OF_LOCAL_PHOTOS
Facts compiled from community research (alloc8or/rdr3-nativedb-data, femga/rdr3_discoveries); descriptions and examples by The Lab.