Skip to content

A3D_OverlapBox

imshooter edited this page Oct 17, 2026 · 1 revision

Find everything a box overlaps, such as the room a vehicle or an object needs.

native A3D_OverlapBox(
    Float:sizeX,
    Float:sizeY,
    Float:sizeZ,
    Float:x,
    Float:y,
    Float:z,
    Float:rx,
    Float:ry,
    Float:rz,
    A3D_HIT:types[],
    hitids[],
    size = sizeof (hitids),
    worldid = -1,
    A3D_COLLIDE:flags = A3D_COLLIDE_ALL
);

Parameters

Parameter Description Default
Float:sizeX Size on the X axis.
Float:sizeY Size on the Y axis.
Float:sizeZ Size on the Z axis.
Float:x Centre on the X axis.
Float:y Centre on the Y axis.
Float:z Centre on the Z axis.
Float:rx Rotation on the X axis.
Float:ry Rotation on the Y axis.
Float:rz Rotation on the Z axis.
A3D_HIT:types[] What each thing found is.
hitids[] What each thing found is, as the hitid of A3D_RayCast.
size Room in each array. sizeof (hitids)
worldid Virtual world to look in, or -1 for every world. -1
A3D_COLLIDE:flags What may be found. A3D_COLLIDE_ALL

Returns

  • The number of things written.

Remarks

The box is centred on the position and turned by the rotation, like an object. A box that rests on the ground overlaps it, so lift it a few centimetres or leave A3D_COLLIDE_MAP out of the flags when the ground does not matter. Everything else follows A3D_OverlapSphere.

Example

Tells whether a parking space is free before a vehicle is created on it.

stock bool:IsSpaceFree(modelid, Float:x, Float:y, Float:z, Float:angle) {
    new
        Float:sizeX,
        Float:sizeY,
        Float:sizeZ,
        A3D_HIT:types[1],
        hitids[1]
    ;

    GetVehicleModelInfo(modelid, VEHICLE_MODEL_INFO_SIZE, sizeX, sizeY, sizeZ);

    return A3D_OverlapBox(sizeX, sizeY, sizeZ, x, y, z + 0.1, 0.0, 0.0, angle, types, hitids, .flags = A3D_COLLIDE_ALL & ~A3D_COLLIDE_MAP) == 0;
}

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
Callbacks

Clone this wiki locally