Skip to content

A3D_OverlapModel

imshooter edited this page Oct 18, 2026 · 2 revisions

Find everything a model would overlap at a position, such as before placing an object.

The model counts as the shape it moves with: the shape models.json gives it, or the convex hull of its collision, which covers the gaps of a hollow model.

native A3D_OverlapModel(
    modelid,
    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
modelid Model to place.
Float:x Position on the X axis.
Float:y Position on the Y axis.
Float:z Position 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.
  • 0 when the model has no collision and no shape in models.json.

Remarks

The model counts as the convex hull it moves with, which fills its hollows. A chair counts as the block around its legs, seat and back. The answer is exact for solid models and generous for hollow ones.

Example

Lists what a piece of furniture would touch.

stock ListObstacles(playerid, modelid, Float:x, Float:y, Float:z, Float:angle) {
    new
        A3D_HIT:types[8],
        hitids[8],
        message[64],
        count = A3D_OverlapModel(modelid, x, y, z, 0.0, 0.0, angle, types, hitids, .flags = A3D_COLLIDE_ALL & ~A3D_COLLIDE_MAP)
    ;

    for (new i; i != count; ++i) {
        format(message, sizeof (message), "In the way: type %i, id %i.", _:types[i], hitids[i]);
        SendClientMessage(playerid, -1, message);
    }
}

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