Skip to content

A3D_WalkRayCast

imshooter edited this page Oct 23, 2026 · 1 revision

Find where a straight walk between two points is stopped by a wall, a building, a ledge or the water.

The walk follows the ground, up and down slopes and stairs. A start off the mesh stops it where it starts.

native bool:A3D_WalkRayCast(
    Float:fromX,
    Float:fromY,
    Float:fromZ,
    Float:toX,
    Float:toY,
    Float:toZ,
    &Float:x = 0.0,
    &Float:y = 0.0,
    &Float:z = 0.0
);

Parameters

Parameter Description Default
Float:fromX Start on the X axis.
Float:fromY Start on the Y axis.
Float:fromZ Start on the Z axis.
Float:toX End on the X axis.
Float:toY End on the Y axis.
Float:toZ End on the Z axis.
&Float:x Where the walk stops on the X axis. 0.0
&Float:y Where the walk stops on the Y axis. 0.0
&Float:z Where the walk stops on the Z axis. 0.0

Returns

  • true when the walk is stopped.
  • false when the way is clear.

Remarks

Unlike A3D_IsLineOfSight, the walk follows the floor. A wall, a fence, a step higher than 45 centimetres, a drop or deep water stops it, and a gap under a fence or a window does not let it through. Only where the end lies across the floor matters, not its height.

Example

Whether a player can run to another in a straight line.

stock bool:CanRunStraightTo(playerid, targetid) {
    new
        Float:x,
        Float:y,
        Float:z,
        Float:targetX,
        Float:targetY,
        Float:targetZ
    ;

    GetPlayerPos(playerid, x, y, z);
    GetPlayerPos(targetid, targetX, targetY, targetZ);

    return !A3D_WalkRayCast(x, y, z, targetX, targetY, targetZ);
}

Related

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