Skip to content

A3D_GetModelBoundingSphere

imshooter edited this page Oct 17, 2026 · 1 revision

Find the sphere that holds a model, around its position.

native bool:A3D_GetModelBoundingSphere(modelid, &Float:x, &Float:y, &Float:z, &Float:radius);

Parameters

Parameter Description
modelid Model to read.
&Float:x Centre on the X axis.
&Float:y Centre on the Y axis.
&Float:z Centre on the Z axis.
&Float:radius Radius of the sphere.

Returns

  • true when the sphere was written.
  • false when the database does not know the model.

Remarks

The centre is an offset from the origin of the model, as for A3D_GetModelBoundingBox. The sphere holds the whole model, so for a round model its radius suits A3D_CreateSphere.

Example

stock Physic:CreateModelSphere(modelid, Float:x, Float:y, Float:z, Float:mass) {
    new
        Float:centreX,
        Float:centreY,
        Float:centreZ,
        Float:radius
    ;

    if (!A3D_GetModelBoundingSphere(modelid, centreX, centreY, centreZ, radius)) {
        return INVALID_PHYSIC_ID;
    }

    return A3D_CreateSphere(modelid, radius, x, y, z, mass);
}

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