Allow engineLoadCOL to accept tables of spheres, boxes, and mesh triangles, and add engineSetCOLData plus EngineCOL:setData for live updates.
Generate validated COL1 buffers client-side so resources can build procedural collision without temporary files. Preserve legacy file and raw-data loading, and repoint every replaced model before destroying the old collision to avoid dangling pointers.
Validate finite values, native counts, indices, materials, coordinate ranges, and repeated triangle vertices before passing data to GTA. Add serializer tests for valid output and malformed collision data.
Tested with Client Deathmatch Release|Win32, all 318 Tests_Client tests, and in-game create, live resize, wall, ramp, procedural, and OOP collision updates.
Summary
0817.1._10mb.mp4
Allow
engineLoadCOLto create collision models directly from Lua tables containing spheres, boxes and triangle meshes.Collision data can also be updated while the resource is running:
Models using the collision are updated immediately. Existing file and raw data support in
engineLoadCOLremains unchanged.The input is validated before being passed to GTA, including materials, coordinates, indices and native format limits.
Motivation
Resources currently need a pre-generated
.colfile to load custom collision.Creating custom collision currently requires generating and shipping a separate
.colfile, even for a simple box or sphere.This allows resources to define collision directly next to their Lua code. The same collision can also be updated at runtime when an object's size or shape changes.
The video uses the included test resource. It creates a wall, resizes its collision while running and turns the same collision into a ramp.
Test plan
Tested the included wall/ramp resource:
runtime-collision-wall-demo/walland place both endpointsEto resize the wallUto change its heightPto turn it into a rampNote : This feature was originally implemented in my fork and has been tested with my community in various scenarios, the original documentation covers the table format, limits and live updates.
Test resource :
runtime-collision-wall-demo.zip
Checklist