Why a separate collision?
Characters, cars and bullets in GTA SA hit the model's collision, not what you see. A good-looking model has tens of thousands of triangles; a collision needs far fewer, which means less work for the game on every step, shot and crash.
The generator writes a .col file in COL3, the same format the game uses. It simplifies with QEM (it collapses edges where the shape barely changes), so flat walls, corners and edges stay in place even at a low triangle count. Below the preview you see how far the collision strays from the model, at most and on average.
Step by step
- Drop the model on the field above. Drop a
.gltftogether with its.bin(select both at once). - Pick a mode and a triangle count. The result updates after every change; the orange wireframe in the preview is the collision.
- Untick materials that need no collision (glass, leaves, curtains) and set the surface: one default for everything or one per material.
- Download the .col file, put it in your resource next to the model and list it in
meta.xml. - Load it in a client script before replacing the model:
<!-- meta.xml -->
<file src="lamp.glb" />
<file src="lamp.col" />
<script src="client.lua" type="client" />
-- client.lua
local col = engineLoadCOL(":my_resource/lamp.col")
engineReplaceCOL(col, 1337)
engineReplaceModel(engineLoadMesh(":my_resource/lamp.glb"), 1337)
Axes and units follow the same rules as engineLoadMesh, so the collision sits exactly under the model with no offset.
Which mode should I pick?
| Mode | What it does | Good for |
|---|---|---|
| Mesh | A simplified triangle mesh that follows the model closely. | Buildings, interiors, stairs, ramps, anything with hollows. |
| Hull | The smallest convex shape that encloses the whole model. | Rocks, statues, odd-shaped crates. No hollows or openings. |
| Boxes | A few boxes fitted from voxels. | Furniture, fences, stalls. Very cheap for the game. |
| Box | One box the size of the model. | Crates, containers, vending machines. |
| Sphere | The smallest sphere around the model. | Barrels, balls, bushes, small items. |
How many triangles?
- 50–300: small props: a bollard, a bench, a bin.
- 300–1,500: furniture, decorative cars, small buildings.
- 1,500–6,000: buildings with interiors, bridges, drivable ramps.
- Up to 12,000: large pieces of map. More rarely improves driving and costs the game more.
Watch the "largest shape error". A few centimetres is fine for walking; if it grows to tens of centimetres, characters float in the air or walk into walls. COL3 holds at most 65,535 triangles, and the model must fit within 255 m of its centre.
Materials and surfaces
The material list shows what the model is made of. Materials that look transparent (glass, windows, leaves, alpha textures) start unticked: a tree collides with its trunk and branches, not its crown. You can change that.
The surface sets footstep sounds, bullet sparks and tyre marks. Set one for the whole model or a different one per material, e.g. wood for the floor and glass for windows. Per-material surfaces apply in "Mesh" mode; boxes, hull and sphere use the default surface.
Formats and axes
- FBX (binary and text): units and up axis from the file, object transforms.
- OBJ, glTF, GLB: Y-up converted to Z-up as in the game. glTF with node transforms.
- DFF from GTA SA: RenderWare frames; LOD models (
_vlo), damaged parts (_dam) and wheels are skipped. - 3DS, STL, PLY: coordinates as they are, in metres.
- COL: drop an existing
.colfile (COLL, COL2, COL3, COL4) to inspect its collision.
One metre in game is one unit. A Blender model saved in metres has the right size straight away; the preview shows the dimensions below the image.
No file: collision computed in game
The same generator lives in the game client. engineReplaceModel without a .col file builds one by itself (up to 12,000 triangles, no transparent materials). Pass your own settings to engineGenerateCOL:
local mesh = engineLoadMesh(":my_resource/house.fbx")
local col = engineGenerateCOL(mesh, { mode = "mesh", triangles = 2500, material = 43, skipTransparent = true })
if col then
engineReplaceCOL(col, 1337)
outputChatBox(("collision: %d of %d triangles, error %.2f m"):format(col.generatedFaces, col.originalFaces, col.deviation or 0))
end
A ready file is better for big models: the game computes nothing when a player joins, and you see the result before release. Below the generator preview there is a ready call with your settings. All options are in the engineGenerateCOL documentation.
Problems
- Characters walk through a wall: the wall is too thin or there are too few triangles. Raise the count or thicken the wall in the model.
- Characters float above the floor: check the "largest shape error" and raise the triangle count. In "Hull" mode hollows are always closed.
- The collision is next to the model: the model has an offset origin or unapplied transforms. In Blender: Object → Apply → All Transforms, then export.
- "The model reaches more than 255 m": split the model into several objects.
- The .bin file is missing: select the
.gltfand.bintogether or save the model as.glb.