Impact Deformable

Impact Deformable Logo

Impact deformable was designed to provide Unity3D projects with automatic mesh deformation from physical impacts. It works with any kind of mesh / collider.

It has been hard times for this poor car

It has been hard times for this poor car

In essence, it transforms OnCollisionEnter and OnCollisionStay events into visible mesh deformations. It has been used in many styles of Unity game projects (race/driving, war simulations, real time strategy) targeting all platforms.

 

Restoring car mesh to undeformed state

Restoring car mesh to undeformed state

Mesh deformation is performed at vertices level (no new geometry is created in the process), so deformation quality is tied with mesh quality. Is it possible to repair the deformation (total or gradual repair) with a single call to a public method:

// Repair method
ImpactDeformable.Repair(percentage, point, radius);

 

Here is a code to repair a small area on the object clicked with the mouse button:

Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit = new RaycastHit();
if (Physics.Raycast(ray, out hit))
{
  ImpactDeformable impactDeformable = hit.collider.GetComponent<ImpactDeformable>();

  // Check if clicked object is deformable
  if (impactDeformable != null)
    // Repair 5% of deformation on vertices within 0.75 of distance from hit point
    impactDeformable.Repair(0.05f, hit.point, 0.75f);
}

 

It’s also possible to query Impact Deformable component for damage estimation, calculated from the current deformation on the object:

public float CarDamage
{
  get
  {
    // CarHullDeformed is the Impact Deformable component attached to the car object
    // Return calculated damage in 0..1 range
    return Mathf.Clamp01(CarHullDeformable.StructuralDamage / 0.065f);
  }
}

 

The deformation process can be controlled trough many exposed properties.
For example, the Hardness (float) property configures amount of distortion that the object will suffer from each impact.

Different hardness settings against same impact force

Different hardness settings against same impact force

 

If the object is connected with a MeshCollider, Impact Deformable can be instructed to deform it along with the mesh, effectively changing the collision shape.

Deformed MeshCollider changing object collision shape

Deformed MeshCollider changing object collision shape

 

User manual

Impact Deformable – User Manual (PDF)

Live demo scenes (WebGL)

Car Derby
Metal Rain

Get it in the Unity Asset Store

https://www.assetstore.unity3d.com/en/#!/content/4799

Comments are closed