engineLoadCOL
Loads a collision model from a .col file as in standard MTA, or builds one from a Lua collision table.
Syntax
col|false engineLoadCOL(string|table collision)Arguments
collisionstring|tableA .col file path or raw data for the standard path, or a collision table of spheres, boxes and meshes for the Neon path.
Table keys
Shapes
spherestableoptionalArray of {position = {x,y,z}, radius = n, material = 0-178}. Radius must be greater than zero.
boxestableoptionalArray of {position = {x,y,z}, size = {x,y,z}, material = 0-178}. position is the centre and size is the full extent, not half-extents.
meshestableoptionalArray of {vertices = flat xyz triplets, indices = flat zero-based triangle triplets, material = 0-178}.
Returns
A col element, or false when no resource context exists or the collision could not be built.
Ownership and lifecycle
A generated col element behaves like any other MTA col element: it is parented to the calling resource, applied to models with engineReplaceCOL, and released when destroyed or when the resource stops. Rebuilding its data re-applies the new collision to every model it was already replaced into.
- Passing anything other than a table falls through to the unchanged standard MTA behavior, so existing resources are unaffected.
- The returned element is an ordinary col element. Apply it with engineReplaceCOL and destroy it as usual.
- A malformed table raises a Lua error naming the exact path, such as spheres[2].radius must be finite.
Example
local col = engineLoadCOL({ boxes = { { position = { 0, 0, 0 }, size = { 4, 0.4, 2.5 }, material = 1 } },})engineReplaceCOL(col, engineRequestModel("object", 980))Where this comes from
Continue exploring
← Back to the Neon Lua API · How Runtime collision generation works →