Sign in to follow this  
Tut

Collisions

Recommended Posts

Introduction

A collision model is used by the game to understand the impact between two entities to then calculate physics. These models are physical based, opposed to game models which are visual based. A collision model can generate particles when interacted with by being assigned surface materials. 

This guide is 3D modeling based and does not cover any procedures that require scripting.

TOC

  • Importing collision models from the base game
  • Patching and correcting default game collisions
  • Primitives and why they're beneficial
  • General limitations
  • Surface materials
  • Volumetric shadows 
  • Vehicle collisions

 

Importing collision models from the base game

Collision files from the base game are stored in large collision archives. These archives have the ability to stores numerous collision files, although custom archives aren't compatible with MTA. In order to find these files, it is recommended to have extracted all game models. Reading the section Extracting game assets on this thread is necessary as a first step.

Collision files are named according to their area in the map, where lae_1 is Los Santos East part 1. Clicking any object on Prineside shows its IDE name (item definition) which is the same name used for the collision file. For instance, ID 16003 drvin_ticket belongs in countn2.ide - this means that its collision is stored in countn2_1-20.col (has 20 files from that area). Finding which one contains collision drvin_ticket is like finding the needle in a haystack. Using Steve M's Collision Editor may speed up the process of finding the file containing the collision model. It is also possible to use MEd for getting the collision archive's name, although it's a fairly resources demanding program. 

Using collisions from the base game and then modifying can be beneficial as they're often very optimised, and uses a lot more materials for both material brightness and various different surface properties. Such results may take a lot longer than one wishes to spend on a collision. Most collision models comes with primitives which are great to use and is explained in next part.

Patching and correcting default game collisions

Mappers might often enough come across of furniture objects which pivots around empty air rather than the corner or center of mass. Rockstar did this a lot, especially for beds. As if this wasn't the only issue, Rockstar actually added several broken collisions to the game leading to blue hell (void). These can be patched by 3D modelers. 

To get started with patching a broken collision model, find and load in vegasw_4.col to 3ds Max by following the above part of the guide. Scroll through and locate downvgnbild1 and import said collision. The problem with downvgnbild1's collision is that the store windows can be climbed over, as the ceiling and walls are nor solid. 

Skrmbillede_5522.png     

Every Default's are primitives - that is spheres or boxes. They can be adjusted in height, width, length and radius as well as segments. In this case, from bottom, number 4 and number 5 Default are models that represents the store windows - which are the ones causing the glitch. What exactly causes the glitch? The collision primitives representing the store windows are not tall enough to cover the walls, which essentially means anything can sneak through the gaps. 

From bottom to top, the 4th Default needs be raised in Z from a value of 3,8659m to 7,2524m. Exact same procedure needs be done for 5th Default. Now the collision is solid in every way, preventing characters from climbing in behind the store windows. To export this collision, follow below steps.

  1. Open COL IO. Where it says Export Setting ensure COL3 is highlighted. This is required for GTA SA collisions.
  2. The collision contains a collision mesh named CM_downvgnbild1. This must be registered as mesh by clicking the button Collision Mesh and then clicking the CM_downvgnbild1. Same procedure for Shadow Mesh if it has any (this doesn't). The Collision Mesh button should now read as CM_downvgnbild1.
  3. In the scene, select everything that's part of the collision.
  4. On COL IO there's a text field above the button Export. Here the collision model's name can be defined. Just name it downvgnbild1.
  5. Hit Export and find a place to save it. The file can be named anything the user likes.

 

Primitives and why they're beneficial

Most 3D applications has a library of basic 3D models; primitives. They are common shapes which on creation can have their quality modified and then remodeled afterwards. For GTA San Andreas, collisions support Box and Sphere as collision primitives. Primitives costs a lot less in terms of file sizes, as example, the below sphere's collision model would be 10.4 kb with collision mesh sphere, and 140 bytes with collision primitive sphere - both collision results are equal.

mta-screen_2019-09-01_06-47-05.png

Tall buildings with lots of details e.g support beams tend to use collision primitives as otherwise the collision would sky rocket in file size and polyrates. Some warehouses even use primitives for their gates, exterior fences and walls, while the more complex base models requires a collision mesh. Primitives are named 'Default', though, on export they can be named anything.

 

General limitations

Collision models has certain limits which may explain crashes and strange behavior of models.

  • Collision models can be a maximum of 512 height, 512 width and 512 length. In short, a 512 radius sphere or cube would reach the dimensions limit.
  • Polygon rates of collision meshes (not to be confused with primitives!) should reach no more than 3000. In cases of such high rates, the modeler should either split into multiple files or optimise the mesh further.
  • Collision archives are not supported.
  • No special flags supported. In later GTA's, collisions can be assigned flags such as ladder or staircase flags, which allows high quality stair collisions. In SA however, stairs must be planar ramps.

 

Surface materials

GTA SA engine uses materials for collisions. These materials define what type of surface that the model represents. Kam's COL MTL has 179 ID's. Ranging from tarmac, destroyed tarmac, dry mud, wet mud to sea floor and grass. These surface properties generate sound fx and particle fx when walked, driven or shot upon. Collision material also has brightness setting, where 0 is dark and 150+ is bright. Entities affected by this setting are peds and vehicles.

 

Volumetric shadows

World objects and vehicles are able to cast shadows - dynamic ones. These are meshes stored inside the collision file. Generally the shadow mesh should be slightly smaller than the game mesh, as otherwise it'll glitch on the corners of the model. The setting to display shadows are found in MTA video settings.

 

Vehicle collisions

Where world objects uses separate .col files, vehicles require their collisions to be embedded or baked in the DFF. These collision models consists of mostly spheres but may also be found to contain boxes and of course their collision mesh (prefixed CM_vehicleName). The collisions use spheres due to the engine's ease of calculating physics with those primitives. They are named that of the material Brightness/Part section, e.g Boot or Rear bumper. Ones that are not used by vehicle components are named Default.

In below screenshot, the white lines represents the collision mesh of a Tornado. Usually the collision meshes will suffice with 12 faces total for the hood, windshields, roof, boot and bottom.

Skrmbillede_5517.png

  • Like 1

Share this post


Link to post
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.