Skip to content

A3D_IsModelColliding

imshooter edited this page Oct 18, 2026 · 2 revisions

Whether a model would touch anything at a position.

Stops at the first thing found, so it is cheaper than A3D_OverlapModel. The model counts as the shape it moves with, like in A3D_OverlapModel.

native bool:A3D_IsModelColliding(
    modelid,
    Float:x,
    Float:y,
    Float:z,
    Float:rx = 0.0,
    Float:ry = 0.0,
    Float:rz = 0.0,
    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. 0.0
Float:ry Rotation on the Y axis. 0.0
Float:rz Rotation on the Z axis. 0.0
worldid Virtual world to look in, or -1 for every world. -1
A3D_COLLIDE:flags What may be touched. A3D_COLLIDE_ALL

Returns

  • true when it would touch something.
  • false when the place is free, or the model has no collision and no shape in models.json.

Remarks

The model counts as its convex hull, as in A3D_OverlapModel. A model that rests on the ground touches it, so lift it a few centimetres or leave A3D_COLLIDE_MAP out of the flags.

The answer comes at the first thing found, which makes it the cheap test before placing something. A test costs about two microseconds.

Example

Refuses to place furniture inside other furniture or a vehicle.

stock bool:CanPlaceFurniture(modelid, Float:x, Float:y, Float:z, Float:angle, worldid) {
    return !A3D_IsModelColliding(modelid, x, y, z + 0.02, 0.0, 0.0, angle, worldid, A3D_COLLIDE_STATIC | A3D_COLLIDE_VEHICLES | A3D_COLLIDE_OBJECTS);
}

Related

  • A3D_OverlapModel: Find everything a model would overlap at a position, such as before placing an object.
  • A3D_FindRandomPoint: Find a random spot on the ground around a point where something fits, such as a spawn or a dropped item.
  • A3D_CreateStaticObject: Create a physics object that never moves, shaped like the collision of a model.

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