Last modified 6 years ago Last modified on 2011-09-17 12:13:56

CarDamage

Performs the mesh deformation on impacts. Also deforms nodes (Transforms) and colliders.

This script is typically located at the vehicle's root GameObject.

minForce: minimum relative speed in m/s between the contact points required for detecting the contact as an impact.

multiplier: a measure of the influence the relative velocity between the contact points has in the deformation. The bigger this value, the more deformation. Experiment with this property in order to get the desired result.

deformRadius (m): distance around the contact point affected by the deformation. The amount of deformation will be maximum at the contact point, then it will decay progressively to no deformation at the limit defined by this value.

deformNoise (m): amount of random deformation applied on each affected vertex of the mesh. This makes the mesh appear as broken.

deformNodeRadius (m): distance around the contact point at which the rotation of the Nodes (see DeformNodes below) will also be affected (deformRadius affects only the position of the Nodes).

maxDeform (m): maximum distance a vertex can be displaced from its original position due to deformation on impacts.

maxNoderotationStep (degrees): maximum rotation angle that can affect the rotation of the Nodes on a single impact. This value is applied on the three euler angles independently.

maxNodeRotation (degrees): maximum rotation angle that the Node's euler angles can be rotated from their original value.

bounceBackSpeed: a measure of the speed at which the vertexes move towards their original positions when repairing the vehicle (function DoBounce).

bounceBackSleepCap: a vertex is considered "repaired" when the distance to its original position is less than this value. Repairing (bounce) stops when all vertexes of the mesh are "repaired".

autoBounce: the vehicle repairs the impact damage automatically.

DeformMeshes

References to the vehicle's meshes that can be affected by impacts. They produce the visual result of the impacts.

DeformNodes

Additional GameObjects of the vehicle ("Nodes") which Position and Rotation are affected by impacts. This is typically used for wheels and steering wheels.

DeformColliders

References of the vehicle's mesh colliders that are affected by impacts. Deforming the collider keeps a coherence between the visible damage and the behavior of the vehicle on further impacts.

The mesh colliders used at vehicles are usually convex mesh colliders. Deforming a convex mesh collider will always result in a convex collider: Unity automatically calculates the convex bounding volume for the collider. The results are fairy good in most cases. Non-convex vehicles typically use two or more overlapping convex mesh colliders.