Collisions - Parik27/DragonFF GitHub Wiki

Importing

Collision files can be imported from the same menu as DFF files. All the 4 version of COL files are supported. All models imported from the file will be imported into a separate collection.

Collision files that are embedded inside a DFF file will be automatically loaded. A new collection will be created for the collision model inside the DFF collection. Note: The collision collection will be hidden by default.

Map Collisions

The map importer can automatically import and position collisions for map objects. See the Map Importer section for more information.

Exporting

Exported Objects

Objects you want to export should have the object type "Collision Object" or "Shadow Object." Shadow objects are generally simplified versions of map geometry that are projected onto their surroundings as a shadow in-game. They must be fully closed meshes to prevent rendering artifacts and are only supported in version 3 of the collision format.

If the object is a mesh, a Collision Object will be exported as collision mesh (used for collisions with peds in GTA).

If the object is an empty, the Collision Object will be exported as a sphere or a box dependent on whether "Sphere" or "Cube" is selected as the display type on the empty's data tab. The empty object's scale will determine the collision shape's dimensions on export. The following image shows a map object with a combination of mesh and box collisions.

image

If you have multiple Collision Meshes, they will be combined into one large Collision Mesh upon export when using the export option from the file menu. Alternatively, there is an option on the context menu of a collection for exporting the collection as a collision container.

image

This will export each nested collection within as a separate collision definition, all collected within a single exported container file. Most map objects have their collisions collected into a handful of container files grouped by region instead of defining each as a separate file. This export option exists mainly to produce a full collision collection for a map region after changes were made to one or more elements within it. The following image shows what a typical map collision container file looks like in Collision File Editor II.

image

Materials

Each material of a collision mesh will have the above properties. The properties are available in Materials for a mesh and Object in an empty.

  • Material - The ID of the material. Affects particles/sounds. List of materials
  • Flags - The flags of the material. Affects the affected parts (Example: The sphere causes the door_lf to be damaged when it collides).
  • Brightness
  • Day Light - The brightness of dynamic objects like cars and peds that come in contact with the surface during the day.
  • Night Light - The brightness of dynamic objects like cars and peds that come in contact with the surface during the night.

Face Groups

image

Versions 2 and 3 of the collision file format support face groups for optimization. Faces are grouped by region so the engine can work with a smaller set of faces to check for collision instead of evaluating the whole mesh for every interaction. The option "Display Face Groups" will shade each group with a different color for group visualization on a selected collision mesh object. The remaining properties control face group generation. The default options should work for most cases, but tweaks may be necessary for larger mesh objects.

image

Objects that have been imported and then modified would of course need their face groups regenerated so care must be taken to do so before re-export. Alternatively, the "face group" attribute can be deleted on the object's data tab to remove existing face groups from a mesh.

image

Bounds

You can edit collision bounds in the Collection Properties panel.

image

By default, bounds are generated automatically based on collisions in the collection when the Auto Bounds option is enabled. To manually edit bounds, you need to disable this option. Collections that don't contain collision objects will not be exported if Auto Bounds is enabled.

To display bounds in the Viewport, enable the Display Bounds option.