[Guide] GTA V: Physics and collisions

GTA:V Modding with ZModeler3 discussion.

Moderator: madga182

[Guide] GTA V: Physics and collisions

Postby Oleg » Sat Aug 08, 2015 8:20 am

GTA V: Physics and collision guide.
Last updated: July 2016.

Physics data is made out of one or more collision volumes with physics properties associated with it. You can assign collision volumes to multiple parts of your hierarchy, but it should not be overweight with collision volumes. For example, you assign a collision volume for chassis, doors and bumpers, but you barely assign collision for suspension elements, or small misc/upgrade parts installed on bumper or trunk. Also, when some object already defines a collision volume for bigger part, it might be enough and smaller parts can omit collision. For example a big part "bodyshell" has no collision, as it's mainly equivalent to chassis model and both utilize the same collision in physics engine.

Only geometry parts can have collision associated with them. All parts of your hierarchy are natively equipped with bounding volumes on export and this might be enough for some small parts like tail lights, reversing signals, headlights, police siren and so on.

Physics of your model is affected by collision components physics data, which includes Mass, Energy and surface properties.

Collision volumes.
Your collision volume could be either geometry object (mesh collision) or a dummy node. All types of dummies except Cone are supported (so you can use Box, Cylinder, Capsule and Sphere dummies). Dummy collision should have Centered option toggled on. Complex shape collision can be combined from a set of simple collision volumes or dummies into a group and this group can be specified as a collision.

In order to specify an object as collision for some part you should append the name of the object with [COL] while the leading part of the name must match the associated owner part name. Such a collision volume should be a child of associated part. For example, the door_dside_f [COL] residing in branch of door_dside_f will be considered as "driver's side front door" collision. Alternatively, you can assign collision into owner compound object as COL state, so your part for driver's side front door being a compound object door_dside_f can include geometries for different LODs and collision volume at a time.
This configuration is compact but has a drawback as you can't toggle visibility of collision and any of geometries at a time, you could see only one of them (collision or one of geometry LODs) at a time.

Simple shapes collision should be made of basic shapes (as low poly as possible) with welded vertices. It is highly recommended to weld vertices, so neighbor polygons share an actual common edge. This will give better results in mesh deformation after impacts. A collision shape on import might be loaded without normals or with odd normals and look smooth. To prevent this, all collision shapes have a Flat shaded rendering mode assigned on them. You can do the same in object's properties:


It is very preferable, but not a must, to convert all collision components into compounds with only one state available: COL. You can do this quickly by toggling on COL state on Structure panel, picking a collision object in hierarchy view and pressing Convert to compound button on Structure panel. It will not take long to convert them all that way. The benefit of this method is that you will be able to show/hide all collisions at once with a single toggle on/off COL state button on Structure panel. This is solely for your convenient and not much important for the exporter.

Shape collision volumes.
There are two types of shape collision volumes: the one that can be deformed, and the one that will not. In most of cases, a deformable collision shape is used for the outer side of your model and non-deformable is used on the inner side. Most of boats and planes use non-deformable collision for "interior". You can create any of these types and specify which collision type you prefer by settings collision mesh vertices format Deformable option:


Deformable shape should be a solid volume with no holes or volumes that are separate from the rest. If you need a complex volume, made it out of several simple volumes and combine them into a group. Additionally, deformable shape should specify the degree of deformation by shifting points of collision volume in Damaged state. You can toggle on Damage state on Structure panel and shift vertices of collision volume into inner side (reducing the volume of the object) to some degree. The following image shows a front bumper collision in default state and in "Damage" state:


The green color shape is an original volume, and blue is a Deformed (damaged) shift/offset variant. This is mix screenshot, you will not be able to see it that way in ZModeler, you could see either original or deformed state only.

Shape collision volume specifies surface properties on polygon IDs. This is a numeric value locate in Properties->General->External State -> ID. I don't have the full list of used IDs, you can check original models and make your own observations on a subject. The image below shows a chassis collision shape with polygons selection. All selected polygons use ID 142 that probably means "no bullet tracing, no colliding with other volumes". It allows collisions for doors and door windows not to "hit" the collision of chassis itself, when you close the door. At the same time, it bypasses bullet tracing on these polygons that allows doors and door window collision volumes to trace bullet in that area and react properly.


You can also see a "Default Compatibility" flags set expanded. These flags are used by game to determine surface behavior in damaged state. I don't have a list of these flags yet, it's up to you to retain them as close to original models as possible.

The most commonly used set of IDs (and flags) are:

116 = metal surface. Sparks are drawn when bullet hit and round metallic bullet shell is drawn when impact detected. This also includes drawing of metal scratches on surface after collision with other objects in scene. No additional flags required usually.
117 = cloth (soft top) surface. Usually equipped with flag #2
120, 121, 122 = glass surface with very low, low and medium stamina. 120 is used for door windows, 121 is usually a rear windscreen and 122 is usually a front windscreen. Usually equipped with flag #3 and flag #8.
123 = non-breakable glass. Can be found on boats small windows.Usually equipped with flag #2 and flag #3.
142 = no hit-test area. Used mostly on chassis collision. Usually equipped with flag #3 and flag #4.

Primitive volume collisions.

You can use dummy helpers of Box,Sphere, Cylinder and Capsule primitives as collision volumes. These have to be create or configured to have Centered option toggled on. Cylinder should use Axis X and Capsule primitive should use Axis Z to conform game needs. The surface property is in ID and compatibility flags too (see paragraph above).

Wheel collision.

Vehicle wheel collision must be made as centered Cylinder dummy node on Axis X. It's size could be adjust in "Dummy properties" in properties window. X-scale is the width of the wheel (and tire tread effect), Y-scale and Z-scale should be identical and these are wheel radius.

Collision groups.

It usually happens that certain collision volume can be made out of several simple convex volumes. In such a case, it is very preferable to create collision as a group of simple convex shapes. You can see this in most of truck or utiltruck models, that have an open trunk. In current version of ZModeler, groups are not editable, so you can't reach group items properties or edit geometry of such an objects. You will need to ungroup them to make editable and group them back when done. When group is inside a compound node, such a compound node must be dismissed first. Once you've done editing individual elements, you can select them in hierarchy and group. Then toggle COL state and convert to compound. Note, element properties are applied to each component of the group, so in order to set a mass of such a collision element, you have to set mass on each item of the group (ZModeler will evaluate entire group mass as a sum of masses of group elements).

Physics properties.

Physics-specific properties of collision volumes are stored as User-defined options on collision elements. When collision object is compound, you have to toggle COL state prior to access or set user-defined options on such an object.

Mass property is the mass of an object in kilos.
E property is unknown 4 values set. I call it "Energy" or "Energy spread", but this could be something different. These values control element behavior in game including deformation level during impacts, and probably other in-game specific properties. In old implementation of GTA:IV filter, this property was evaluated on export depending on associated collision volume boundary. As a result, an in-game model suffer of inaccurate mesh deformation, and/on incorrect behavior of openable elements (like bonnet that drops off after a very small contact). In this filter I leave this property editable, so you can assign your own four values for component physics. You can observe original models and write down the most commonly used component-specific values to reproduce the same on your modded content.

You can make your own considerations and conclusions on these values. If you come up with some ideas, feel free to post on forum, we all could be able to sort this out together when we have more input and testing results.

Updates and changes log.
July 2016:
The following user-defined properties could be added onto COL object. If the COL object is a group of components, the property is added onto entire group (in contrast to "Mass" and "E" property that should be set on each group element).
Stamina user-defined property with four values in it. The first one is an object (component) stamina to user action; other three values are generally the same on most of objects: 100, 1000 and 0.25 (purpose is unknown)
Destroy user-defined property with a set of property bits ranging from 1 to 16 inclusive. Meanings of values are mostly unknown;
9 = Destroy with single gun shot;
11 = destroyed object disappears (applies to light bulbs and other glass objects);
Setting any "Destroy" value on COL object requires you to set non-zero second value in "Base" property of the root dummy node. For example, if you change buffalo2 doors "Destroy" mode to "9, 11", the original "Base" value 20 should be changed to "20, 4" (for drop-off components).
User avatar
Site Admin
Posts: 7943
Joined: Fri Feb 06, 2004 3:54 am

Re: [Guide] GTA V: Physics and collisions

Postby Oleg » Sun Aug 23, 2015 5:36 am

Collision volume convexity is important

Collision object should be convex. ZModeler does not verify topology and allows you to export any collision volume shape, but it is like to be rejected by the game if topology is wrong. Even more, the game can reject related collisions of it detects problem. For example, game will reject chassis collision if any of door collisions is wrong. Below is an example of original GTA4 collision that will not work in GTA5 unless fixed appropriately (expand to see full image) :

User avatar
Site Admin
Posts: 7943
Joined: Fri Feb 06, 2004 3:54 am

Text Guide For All Your Rotation, Flags And Collision Values

Postby madga182 » Thu Oct 15, 2015 9:55 am

The values of the Rotations, Flags, mass and E ... Are to be used as a guide
adjust as necessary for different vehicle weights and sizes.

Thank you For reading and may your modding be fun


----------------------------Rotations Of Moving Parts-------------------------

Boot Rotation And Flags

RotZ 0,0
RotY 0,0
RotX -72,0
Flags E

Bonnet Rotation And Flags

RotZ 0,0
RotY 0,0
RotX 0,72
Flags E

Driver Door Rotation And Flags (Also Applies to Rear Driver Doors)

RotZ 0,0
RotY 0,72
RotX 0,0
Flags E

Passenger Door Rotation And Flags (Also Applies to Rear Passenger Doors)

RotZ 0,0
RotY -72,0
RotX 0,0
Flags E


-----------------------------Collision Values---------------------------------

Mass = 13.2156
E = 0.142806, 0.0273349, 0.11969, 0.0971182

Mass = 745.993
E = 1.16226, 0.290771, 1.3179, 5.48211
E = 1.64477, 0.399181, 1.86934, 8.56036 (alternative)

Mass = 6
E = 0.0240694, 0.111959, 0.102861, 0.04297

Mass = 5
E = 0.110583, 0.0876393, 0.188284, 0.0340694

Mass = 0.5
E = 0.0247546, 0.087055, 0.100528, 0.00301745

Mass = 22.4
E = 0.0258687, 0.191657, 0.199956, 0.164763

Flags = AE
Mass = 14.57
E = 0.0405764, 0.0717447, 0.0405764, 0.107102

Flags = A
Mass = 21.5472
E = 0.0461546, 0.0717447, 0.0461546, 0.158345

Flags = A
Mass = 14.5741
E = 0.0405764, 0.0717447, 0.0405764, 0.107102

Flags = A
Mass = 21.5472
E = 0.0461546, 0.0717447, 0.0461546, 0.158345

Optionally Flags = E is recommended for bumpers and wings, so respective pats will drop off the vehicle at impact.

This guide was created by Madgaz Gaming

Posts: 174
Joined: Thu Aug 13, 2015 5:48 am

Re: [Guide] GTA V: Physics and collisions

Postby Ikey07 » Sat Oct 17, 2015 6:00 am

I can't find any information about how to make that player cant walk through vehicle doors when they are open, maybe someone can explain ?
User avatar
Posts: 17
Joined: Wed Feb 18, 2009 2:03 am

Re: [Guide] GTA V: Physics and collisions

Postby Oleg » Sat Oct 17, 2015 10:28 am

refine collision volumes. if still not work, untick "Deformable" in properties->mesh->vertices->format on problematic collision(s).
User avatar
Site Admin
Posts: 7943
Joined: Fri Feb 06, 2004 3:54 am

Re: [Guide] GTA V: Physics and collisions

Postby Delta4 » Tue May 10, 2016 3:10 am

When I pull the handbrake the back wheels brake for a second and then continue spinning even though I'm still holding on to the handbrake, any ideas on how I could fix this?

This is what it looks like:
Posts: 1
Joined: Tue May 10, 2016 3:04 am

Re: [Guide] GTA V: Physics and collisions

Postby Oleg » Wed Jul 13, 2016 12:25 pm

Updates have been submitted. Check the very first post for details.
User avatar
Site Admin
Posts: 7943
Joined: Fri Feb 06, 2004 3:54 am

Re: [Guide] GTA V: Physics and collisions

Postby orielc » Thu Sep 15, 2016 1:00 pm

if I want to put mirrors instead of the wings which would be the values in "Mass" and "E".
Posts: 9
Joined: Wed Sep 14, 2016 12:56 pm

Re: [Guide] GTA V: Physics and collisions

Postby Oleg » Fri Sep 16, 2016 11:26 am

Keep E of original wing. Set mass of your choice.
User avatar
Site Admin
Posts: 7943
Joined: Fri Feb 06, 2004 3:54 am

Return to Grand Theft Auto V

Who is online

Users browsing this forum: No registered users and 2 guests