Skip to content

A3D_GetRouteTurn

imshooter edited this page Oct 23, 2026 · 1 revision

Read a turn of a route, at a junction where more than two ways meet.

Turns a few metres apart count as one, so crossing a divided road is a single turn. A route that starts against heading begins with A3D_TURN_BACK at its first point.

native A3D_TURN:A3D_GetRouteTurn(
    Route:routeid,
    index,
    &Float:x,
    &Float:y,
    &Float:z,
    &Float:distance = 0.0
);

Parameters

Parameter Description Default
Route:routeid Route to read.
index Index of the turn, from 0.
&Float:x Junction on the X axis.
&Float:y Junction on the Y axis.
&Float:z Junction on the Z axis.
&Float:distance Distance from the start of the route to the junction, in metres. 0.0

Returns

  • The turn.
  • A3D_TURN_NONE when the route or the turn does not exist.

Remarks

The angle of a turn is measured between the directions of the roads a few metres before and after the junction. Turns tells what each value means. Turns closer than 25 metres count as one, so crossing a divided road is one left turn rather than two.

Example

Writes a turn as a driver reads it.

static const gTurnText[A3D_TURN][] = {
    "Continue",
    "Keep left",
    "Turn left",
    "Turn sharp left",
    "Keep right",
    "Turn right",
    "Turn sharp right",
    "Turn back"
};

stock DescribeTurn(Route:routeid, index, text[], size = sizeof (text)) {
    new
        Float:x,
        Float:y,
        Float:z,
        Float:distance,
        A3D_TURN:turn = A3D_GetRouteTurn(routeid, index, x, y, z, distance)
    ;

    format(text, size, "%s after %.0f metres", gTurnText[turn], distance);
}

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