Skip to content

A3D_GetNearestWalkPoint

imshooter edited this page Oct 23, 2026 · 1 revision

Find the nearest point of the navigation mesh, where a pedestrian can stand.

native bool:A3D_GetNearestWalkPoint(
    Float:x,
    Float:y,
    Float:z,
    &Float:walkX,
    &Float:walkY,
    &Float:walkZ,
    Float:reach = 3.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:walkX Point of the mesh on the X axis.
&Float:walkY Point of the mesh on the Y axis.
&Float:walkZ Point of the mesh on the Z axis.
Float:reach How far to look across, in metres. Twice as far is looked up and down. 3.0

Returns

  • true when the mesh is within reach.
  • false when it is not, or there is no navigation mesh.

Remarks

The point is on a floor where a person of 1.8 metres stands, at least 35 centimetres from any wall, so an actor or a pickup put there stands free. reach looks that far across and twice as far up and down, so a point inside a wall or in the air above the floor finds the floor.

Example

Puts an actor on the floor near a point.

stock CreateActorOnFloor(skin, Float:x, Float:y, Float:z, Float:angle) {
    new
        Float:walkX,
        Float:walkY,
        Float:walkZ
    ;

    if (!A3D_GetNearestWalkPoint(x, y, z, walkX, walkY, walkZ)) {
        return INVALID_ACTOR_ID;
    }

    return CreateActor(skin, walkX, walkY, walkZ + 1.0, angle);
}

Related

  • A3D_GetRandomWalkPoint: Find a random point of the navigation mesh within a radius, which can be walked to from the centre, such as where an actor wanders next.
  • A3D_WalkRayCast: Find where a straight walk between two points is stopped by a wall, a building, a ledge or the water.
  • A3D_GetNearestPathPoint: Find the nearest point of a path a route can use, and the direction of the path there.

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