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.

Table of Contents

  • 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.

The best way of getting the name and location of an object's collision is using SAMP Editor. Simply double clicking the object shows the name of the collision and which .col it's stored inside. It's possible to have an instance of MTA running and then open SAMP Editor, by having a separate gta sa installation specifically for SAMP Editor.

Collision files are named according to their area in the map, where lae_1 is Los Santos East part 1. Although SAMP Editor option is often better, Prineside also offers a way of getting to know the collision name. 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-model 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.

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.
  • A collision file can contain up to 65535 spheres, boxes and faces.
  • Collision archives are not supported in MTA unlike in GTA.
  • There are cases where invisible collisions appear even after following the rules of thumb for exporting collisions. Isolated edges and vertices can be contributors to invisible collision walls. For reproduction steps follow this Discord channel link to MTA discord.

 

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. 
The below spoiler contains a list of all surface materials and their ID's.

Spoiler

Vehicle damage parts

0 - Default
1 - Bonnet
2 - Boot
3 - Front Bumper
4 - Rear Bumper
5 - Left Front Door
6 - Right Front Door
7 - Left Rear Door
8 - Right Rear Door
9 - Left Front Wing
10 - Right Front Wing
11 - Left Rear Wing
12 - Right Rear Wing
17 - Windscreen

Collision surfaces

0 - Default
1 - Tarmac
2 - Tarmac_:Oed
3 - Tarmac_really:Oed
4 - Pavement
5 - Pavement_:Oed
6 - Gravel
7 - :Oed_concrete
8  - Painted_ground
9 - Grass_short_lush
10 - Grass_medium_lush
11 - Grass_long_lush
12 - Grass_short_dry
13 - Grass_medium_dry
14 - Grass_long_dry
15 - Golfgrass_rough
16 - Golfgrass_smooth
17 - Steep_slidygrass
18 - Steep_cliff
19 - Flowerbed
20 - Meadow
21 - Wasteground
22 - Woodlandground
23 - Vegetation
24 - Mud_wet
25 - Mud_dry
26 - Dirt
27 - Dirttrack
28 - Sand_deep
29 - Sand_medium
30 - Sand_compact
31 - Sand_arid
32 - Sand_more
33 - Sand_beach
34 - Concrete_beach
35 - Rock_dry
36 - Rock_wet
37 - Rock_cliff
38 - Water_riverbed
39 - Water_shallow
40 - Cornfield
41 - Hedge
42 - Wood_crates
43 - Wood_solid
44 - Wood_thin
45 - Glass
46 - Glass_windows_large
47 - Glass_windows_small
48 - Empty1
49 - Empty2
50 - Garage_door
51 - Thick_metal_plate
52 - Scaffold_pole
53 - Lamp_post
54 - Metal_gate
55 - Metal_chain_fence
56 - Girder
57 - Fire_hydrant
58 - Container
59 - News_vendor
60 - Wheelbase
61 - Cardboardbox
62 - Ped
63 - Car
64 - Car_panel
65 - Car_movingcomponent
66 - Transparent_cloth (I believe this is collidable, but can be shot through... needs additional testing)
67 - Rubber
68 - Plastic
69 - Transparent_stone
70 - Wood_bench
71 - Carpet
72 - Floorboard
73 - Stairswood
74 - P_sand
75 - P_sand_dense
76 - P_sand_arid
77 - P_sand_compact
78 - P_sand_rocky
79 - P_sandbeach
80 - P_grass_short
81 - P_grass_meadow
82 - P_grass_dry
83 - P_woodland
84 - P_wooddense
85 - P_roadside
86 - P_roadsidedes
87 - P_flowerbed
88 - P_wasteground
89 - P_concrete
90 - P_officedesk
91 - P_711shelf1
92 - P_711shelf2
93 - P_711shelf3
94 - P_restuaranttable
95 - P_bartable
96 - P_underwaterlush
97 - P_underwaterbarren
98 - P_underwatercoral
99 - P_underwaterdeep
100 - P_riverbed
101 - P_rubble
102 - P_bedroomfloor
103 - P_kirchenfloor
104 - P_livingrmfloor
105 - P_corridorfloor
106 - P_711floor
107 - P_fastfoodfloor
108 - P_skankyfloor
109 - P_mountain
110 - P_marsh
111 - P_bushy
112 - P_bushymix
113 - P_mushydry
114 - P_mushymid
115 - P_grassweeflowers
116 - P_grassdrytall
117 - P_grasslushtall
118 - P_grassgrnmix
119 - P_grassbrnmix
120 - P_grasslow
121 - P_grassrocky
122 - P_grasssmalltrees
123 - P_dirtrocky
124 - P_dirtweeds
125 - P_grassweeds
126 - P_riveredge
127 - P_poolside
128 - P_foreststumps
129 - P_foreststicks
130 - P_forrestleaves
131 - P_desertrocks
132 - P_forrestdry
133 - P_sparseflowers
134 - P_buildingsite
135 - P_docklands
136 - P_industrial
137 - P_industjetty
138 - P_concretelitter
139 - P_alleyrubbish
140 - P_junkyardpiles
141 - P_junkyardgrnd
142 - P_dump
143 - P_cactusdense
144 - P_airportgrnd
145 - P_cornfield
146 - P_grasslight
147 - P_grasslighter
148 - P_grasslighter2
149 - P_grassmid1
150 - P_grassmid2
151 - P_grassdark
152 - P_grassdark2
153 - P_grassdirtmid
154 - P_riverbedstone
155 - P_riverbedshallow
156 - P_riverbedweeds
157 - P_seaweed
158 - Door
159 - Plasticbarrier
160 - Parkgrass
161 - Stairsstone
162 - Stairsmetal
163 - Stairscarpet
164 - Floormetal
165 - Floorconcrete
166 - Bin_bag
167 - Thin_metal_sheet
168 - Metal_barrel
169 - Plastic_cone
170 - Plastic_dumpster
171 - Metal_dumpster
172 - Wood_picket_fence
173 - Wood_slatted_fence
174 - Wood_ranch_fence
175 - Unbreakable_glass
176 - Hay_bale
177 - Gore
178 - Railtrack

 

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 5
  • Thanks 1

Share this post


Link to post
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.