Skip to content

A3D_GetActorsInCone

imshooter edited this page Oct 17, 2026 · 1 revision

Find the actors inside a cone, such as the view of a guard, nearest first.

An actor is measured at the height of the chest.

native A3D_GetActorsInCone(
    Float:x,
    Float:y,
    Float:z,
    Float:directionX,
    Float:directionY,
    Float:directionZ,
    Float:angle,
    Float:range,
    actors[],
    size = sizeof (actors),
    worldid = -1,
    bool:sight = false
);

Parameters

Parameter Description Default
Float:x Apex of the cone on the X axis.
Float:y Apex on the Y axis.
Float:z Apex on the Z axis.
Float:directionX Direction of the cone on the X axis.
Float:directionY Direction on the Y axis.
Float:directionZ Direction on the Z axis.
Float:angle Angle between the direction and the side of the cone, in degrees.
Float:range Length of the cone.
actors[] The actors found.
size Room in actors. sizeof (actors)
worldid Virtual world of the actors, or -1 for any. -1
bool:sight Whether the apex must see them, with the map and static objects in the way. false

Returns

  • The number of actors written.

Remarks

The cone works as in A3D_GetPlayersInCone, measured at the chest of each actor.

Example

Tells whether a player stands in front of a shopkeeper, from the point of view of the player.

stock bool:IsFacingShopkeeper(playerid, actorid) {
    new
        Float:x,
        Float:y,
        Float:z,
        Float:angle,
        actors[4],
        count
    ;

    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, angle);
    count = A3D_GetActorsInCone(x, y, z + 0.5, -floatsin(angle, degrees), floatcos(angle, degrees), 0.0, 30.0, 4.0, actors, .worldid = GetPlayerVirtualWorld(playerid), .sight = true);

    for (new i; i != count; ++i) {
        if (actors[i] == actorid) {
            return true;
        }
    }

    return false;
}

Related

  • A3D_GetActorsInSphere: Find the actors within a distance of a point, nearest first.
  • A3D_GetPlayersInCone: Find the players inside a cone, such as the view of a guard or the spread of a shotgun, nearest first.

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