Skip to content

A3D_IsPointInWater

imshooter edited this page Oct 17, 2026 · 1 revision

Whether a point lies in the water of the map.

The point must be under the surface with nothing of the map between them, so the pool of an interior placed above the city does not flood the streets below it.

native bool:A3D_IsPointInWater(Float:x, Float:y, Float:z, &Float:depth = 0.0);

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 the point lies. 0.0

Returns

  • true when the point is in water.
  • false when it is not, or the database has no water.

Remarks

depth is the height of the surface over the point. A player stands in water up to the waist when their position is about 0.0 deep, and is under water when it is over 1.0.

A call costs about 0.6 microseconds, a ray included.

Example

Tells whether a player is diving.

stock bool:IsDiving(playerid) {
    new
        Float:x,
        Float:y,
        Float:z,
        Float:depth
    ;

    GetPlayerPos(playerid, x, y, z);

    if (!A3D_IsPointInWater(x, y, z, depth)) {
        return false;
    }

    return depth > 1.0;
}

Related

  • A3D_GetWaterLevel: Find the height of the water at a point of the map.
  • A3D_SetBuoyancy: Make a moving physics object float in the water of the map.
  • A3D_RayCast: Find the first thing a segment between two points hits.

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