Destructible Vehicles with Fixed Joints

Hello there! Me and @danaby2 recently released a mod called Destructible Derby Cars, a pack of three different vehicles that have parts that fall off and react to collision/sudden force changes. This guide will explain how I did it and how you can make it yourself.

[TL:DR for expert Unity users and a Unitypackage at the bottom]

Firstly Danaby created a demolition derby car and it was split into multiple sections (different objects) in Blender. Each object is a part that can fall off with the exception of the base model (Model_0). As you can see only the base model has to be named Model_0, the parts that can fall off can be named whatever you want, so I kept the default object names.

While in Unity every object should be a child of Vehicle. Import as .Blend to keep the origin positions to avoid extra effort and time required.

Now to the fun part!
Select all objects in the hierarchy that are supposed to be destructible and give them the following components:
A rigidbody component, which gives the entity physics and the ability to react to environments.
A fixed joint component, a component that keeps the object in place relative to a specified connected rigidbody. The fixed joint should have a break force, which allows the joint to snap when specified force is applied to the object.
A box collider fitting the object’s shape relatively well. Remember to not make the Vehicle prefab and your objects’ box colliders clip into each other, as this will cause the parts to instantly fall off.
(Optional) A hinge joint, allowing doors or hoods that swing instead of falling of after collision. More on that later.

https://imgur.com/a/gk7bV The component values that should be specified.

If you want to have a for example door that begins swaying instead of falling off, kind of like in GTA 3 you must use hinge joints combined with fixed joints. Have the regular setup I told about befor, but make the break force for the fixed joint Infinity, and add a hinge joint component with these values. (Ignore anchor values and axis, they are determined based on the origin of the model). The hinge joint should not have a break force.If you want to learn more about hinge joints, check YT for tutorials.

Tag and layer the gameobject with any tag or layer that can collide with the ground, like vehicle or debris (Vehicle tag can be quite glitchy).

TL:DR for experienced users: Split each destructible segment into different objects, with the main body called Model_0. In Unity, give each destructible model a fixed joint, collider and a rigidbody with Use Gravity enabled. Connect them to Vehicle. To give the objects a swinging effect instead of a destructible one, remove the break force and add a hinge joint.

Unitypackage: https://cdn.discordapp.com/attachments/344277218874097670/385119751065698306/Derby.unitypackage MediaFire didn’t work, so here’s a Discord link to the attachment.

VirusTotal scan: https://www.virustotal.com/#/url/48520ce3f08b8df629ca14c4e3f59271dc81955bccc99b2e3fd4b2ed8e87daf0/detection

Report errors/inconsistencies in the comment section.

Good luck! :smiley:

lol xd

9 Likes

do you have a video showing the result?

Not right now, might make a GIF soon though.

alright then

I love the mod, however the Doors seem to mess up handling. Can you try out a solid door version instead of a swinging one?

Infact the doors don’t mess it up based on my testing. My theory is that the bad handling comes from all the extra rigidbodies that are added regadless of doors in a destructible vehicle. I might be wrong though.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.