Repository navigation
A3D_CreateBox
imshooter edited this page Oct 18, 2026
·
2 revisions
Create a moving physics object shaped like a box.
native Physic:A3D_CreateBox(
modelid,
Float:sizeX,
Float:sizeY,
Float:sizeZ,
Float:x,
Float:y,
Float:z,
Float:rx = 0.0,
Float:ry = 0.0,
Float:rz = 0.0,
Float:mass = 1.0,
worldid = -1
);| Parameter | Description | Default |
|---|---|---|
modelid |
Model shown, or -1 for none. |
|
Float:sizeX |
Size on the X axis. | |
Float:sizeY |
Size on the Y axis. | |
Float:sizeZ |
Size on the Z axis. | |
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 |
Float:mass |
Mass in kilograms. | 1.0 |
worldid |
Virtual world it collides in, or -1 for every world. |
-1 |
- The physics object.
-
INVALID_PHYSIC_IDwhen a size is not positive, or the world is full.
The sizes are full lengths along the axes of the box, not half lengths. The box is centred on the position, while a model is drawn around its own origin. A model whose collision is not centred on its origin, such as one with its origin at the bottom, fits better with A3D_CreateObject.
A box is cheaper than a model shaped object and slides and tips over like one. The surface of a box is 0. Everything else follows A3D_CreateObject.
Creates a box the size of a model, from the box the game gives it.
stock Physic:CreateModelBox(modelid, Float:x, Float:y, Float:z, Float:angle, Float:mass) {
new
Float:minX,
Float:minY,
Float:minZ,
Float:maxX,
Float:maxY,
Float:maxZ
;
if (!A3D_GetModelBoundingBox(modelid, minX, minY, minZ, maxX, maxY, maxZ)) {
return INVALID_PHYSIC_ID;
}
return A3D_CreateBox(modelid, maxX - minX, maxY - minY, maxZ - minZ, x, y, z, 0.0, 0.0, angle, mass);
}-
A3D_CreateObject: Create a moving physics object shaped like the collision of a model, or as
models.jsondescribes the model. - A3D_CreateSphere: Create a moving physics object shaped like a sphere.
- A3D_GetModelBoundingBox: Find the box that holds a model, around its position.
- A3D_CreateStaticBox: Create an invisible box that never moves, such as a wall or a floor.
3DAndreas 0.7.0 · Repository · Releases · MIT License
Guides
- Installation
- Configuration
- Physics objects
- Model settings
- World queries
- The screen
- Routes
- Navigation mesh
- Map database
- Coming from ColAndreas
- Performance
Reference
Functions