Skip to content

A3D_GetActorsOnScreen

imshooter edited this page Oct 17, 2026 · 1 revision

Find the actors on the screen of a player, nearest first, in the same virtual world.

native A3D_GetActorsOnScreen(
    playerid,
    actors[],
    size = sizeof (actors),
    bool:sight = false,
    Float:range = 300.0
);

Parameters

Parameter Description Default
playerid Player whose screen it is.
actors[] The actors found.
size Room in actors. sizeof (actors)
bool:sight Whether the camera must see them, with the map and static objects in the way. false
Float:range How far from the camera to look. 300.0

Returns

  • The number of actors written.

Remarks

An actor shows when their chest lies on the screen, within range of the camera, in the same virtual world. Actors have no interior. With sight, actors behind the map or a static object are left out too.

Example

The actors a player looks at turn to face them.

stock FaceViewer(playerid) {
    new
        Float:x,
        Float:y,
        Float:z,
        Float:actorX,
        Float:actorY,
        Float:actorZ,
        actors[8],
        count = A3D_GetActorsOnScreen(playerid, actors, .sight = true, .range = 20.0)
    ;

    GetPlayerPos(playerid, x, y, z);

    for (new i; i != count; ++i) {
        GetActorPos(actors[i], actorX, actorY, actorZ);
        SetActorFacingAngle(actors[i], atan2(actorX - x, y - actorY));
    }
}

Related

  • A3D_GetPlayersOnScreen: Find the players on the screen of a player, nearest first, in the same virtual world and interior.
  • A3D_GetActorsInCone: Find the actors inside a cone, such as the view of a guard, 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