Repository navigation
A3D_GetScreenTarget
imshooter edited this page Oct 17, 2026
·
1 revision
Find what a point of the screen of a player shows, such as the place they clicked on a grid of text draws.
The player and the vehicle they are in are never hit.
native bool:A3D_GetScreenTarget(
playerid,
Float:screenX,
Float:screenY,
&Float:x,
&Float:y,
&Float:z,
&A3D_HIT:type = A3D_HIT_MAP,
&hitid = 0,
&material = 0,
Float:range = 100.0,
A3D_COLLIDE:flags = A3D_COLLIDE_ALL
);| Parameter | Description | Default |
|---|---|---|
playerid |
Player whose screen it is. | |
Float:screenX |
Point across the screen. | |
Float:screenY |
Point down the screen. | |
&Float:x |
Point shown on the X axis. | |
&Float:y |
Point shown on the Y axis. | |
&Float:z |
Point shown on the Z axis. | |
&A3D_HIT:type |
What it shows. | A3D_HIT_MAP |
&hitid |
Model of the map object, or the physics object, static object, player, vehicle or actor. | 0 |
&material |
Surface of the game it shows. | 0 |
Float:range |
How far to look. | 100.0 |
A3D_COLLIDE:flags |
What may be shown. | A3D_COLLIDE_ALL |
-
truewhen something shows there withinrange. -
falsewhen nothing, or the player sent no camera yet.
The ray starts at the camera and goes through the point of the screen. The player and the vehicle they are in are never hit. Everything else follows A3D_RayCast.
A text draw that a player clicks gives no position, only which text draw it was. A grid of clickable text draws turns each click into a point of the screen, and this native turns that point into a place in the world.
An air strike on the place a player clicks, on a grid of six cells.
static PlayerText:gCells[MAX_PLAYERS][6];
stock ShowStrikeGrid(playerid) {
for (new i; i != 6; ++i) {
gCells[playerid][i] = CreatePlayerTextDraw(playerid, 106.7 + float(i % 3) * 213.3, 112.0 + float(i / 3) * 224.0, "+");
PlayerTextDrawTextSize(playerid, gCells[playerid][i], 40.0, 40.0);
PlayerTextDrawSetSelectable(playerid, gCells[playerid][i], true);
PlayerTextDrawShow(playerid, gCells[playerid][i]);
}
SelectTextDraw(playerid, 0xFF0000FF);
}
public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid) {
new
Float:x,
Float:y,
Float:z,
A3D_HIT:type,
hitid,
material
;
for (new i; i != 6; ++i) {
if (gCells[playerid][i] != playertextid) {
continue;
}
if (A3D_GetScreenTarget(playerid, 106.7 + float(i % 3) * 213.3, 112.0 + float(i / 3) * 224.0, x, y, z, type, hitid, material, 300.0)) {
CreateExplosion(x, y, z, 7, 10.0);
}
return 1;
}
return 0;
}- A3D_ScreenToWorld: Find the direction a point of the screen of a player looks into, from the position of their camera.
- A3D_GetPlayerTarget: Find what a player looks at, from their camera.
- A3D_RayCast: Find the first thing a segment between two points hits.
3DAndreas 0.7.1 · Repository · Releases · MIT License
Guides
- Installation
- Configuration
- Physics objects
- Model settings
- World queries
- The screen
- Routes
- Navigation mesh
- Map database
- Coming from ColAndreas
- Performance
Reference
Functions