Skip to content

A3D_IsPointInsideMap

imshooter edited this page Oct 17, 2026 · 1 revision

Whether a point lies inside the collision of the map, such as a player who fell under the ground or into a closed model.

The surface above the point must be seen from behind and no floor below it seen from above. So a point under a bridge, a roof or the floor of an interior placed in the sky is in the open. A point in a box or a sphere of the map is inside.

native bool:A3D_IsPointInsideMap(Float:x, Float:y, Float:z, &Float:depth = 0.0, worldid = -1);

Parameters

Parameter Description Default
Float:x Point on the X axis.
Float:y Point on the Y axis.
Float:z Point on the Z axis.
&Float:depth How far under the surface above it the point lies, 0.0 in a box or a sphere. 0.0
worldid Virtual world, for the map objects removed in it, or -1 for every world. -1

Returns

  • true when the point is inside the map.
  • false when it is in the open.

How it works

The collision of the game is a skin of faces with nothing inside, and each face is solid from one side only. The native looks up and down from the point:

  1. A point inside a box or a sphere of the map is inside, with a depth of 0.0.
  2. Otherwise a ray goes up. The first face it meets must be seen from behind, which means from inside the model. A face seen from the front, or no face at all, leaves the point in the open.
  3. A ray then goes down. When the first face below is seen from the front, it is a floor under the point and the point is in the open. This is what keeps a point under a bridge, under a roof or under an interior placed in the sky out of the map.

depth is the distance from the point up to the face above it. Map objects removed in worldid with A3D_RemoveBuilding are left out. Only the map counts, not physics or static objects.

Limits

A point inside a model with no bottom face, such as a rock set on the terrain, sees the terrain below from above and counts as in the open. A point under the terrain or inside a closed model is found. Across Los Santos, every point a metre above the ground was in the open and 354 of 400 points three metres under it were inside.

Example

Lifts the players who fell under the map back onto it, every few seconds.

forward @Rescue_Check();
public @Rescue_Check() {
    new
        Float:x,
        Float:y,
        Float:z,
        Float:depth,
        Float:groundZ
    ;

    for (new playerid; playerid != MAX_PLAYERS; ++playerid) {
        if (GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) {
            continue;
        }

        GetPlayerPos(playerid, x, y, z);

        if (!A3D_IsPointInsideMap(x, y, z, depth, GetPlayerVirtualWorld(playerid))) {
            continue;
        }

        if (A3D_FindGround(x, y, z + depth + 2.0, groundZ, GetPlayerVirtualWorld(playerid))) {
            SetPlayerPos(playerid, x, y, groundZ + 1.0);
        }
    }

    return 1;
}

public OnGameModeInit() {
    SetTimer("@Rescue_Check", 3000, true);

    return 1;
}

Related

  • A3D_FindGround: Find the ground under a point.
  • A3D_FindRandomPoint: Find a random spot on the ground around a point where something fits, such as a spawn or a dropped item.
  • A3D_RemoveBuilding: Remove the map objects of a model around a point, as RemoveBuildingForPlayer does for what players see.

Home

Guides

Reference

Functions

Creating objects
Motion
Placement
Behaviour
Display and data
Rays
Shapes
Players, vehicles and actors
Map probes
Screen
Map objects
Water
Models and surfaces
Rotations and offsets
Vehicles
Routes
Route display
Walking
Callbacks

Clone this wiki locally