Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize the effect of crushing fragments with arbitrary shape in Unity2D pictures

Shulou Source: shulou.com Published: 2022-06-03 18:33:46 10月05日 Update

Editor to share with you Unity2D pictures of how to achieve the effect of arbitrary shape of broken fragments, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Effect demonstration

The final effect is as follows:

Demo project download

The Unity Demo project has been uploaded to CodeChina, and students who are interested can download and study it by themselves.

Address: https://codechina.csdn.net/linxinfa/Unity2DDestruction

Note: the version of Unity I use: 2020.2.7f1c1 (64-bit)

Plug-in Unity 2D Destruction: https://lab.uwa4d.com/lab/5b5ca3a6d7f10a201fe8b8f4 used

Operation step 1. Dental picture: SrpiteRenderer

Display the picture of the tooth by SrpiteRenderer.

As follows:

2. Fragmentation: Explodable

Attach the Explodable component to the tooth, and the Rigidbody2D component will be hung automatically.

Set the Body Type of Rigidbody2D to Kinematic.

3. Polygonal collision body assembly: PolygonCollider2D

Attach the polygonal collision body assembly to the tooth: PolygonCollider2D.

4. Generate fragments: Generate Fragments

Click the Generate Fragments button of the Explodable component to generate fragments.

As follows:

You can set the shape type of the fragment, change it to Voronoi type, and add an additional 20 points.

The effect is as follows:

5. Click fragmentation: ExplodeOnClick

Add ExplodeOnClick to the teeth to achieve the effect of click fragmentation.

The running effect is as follows:

6. Fragmentation blasting: ExplosionForce

Create an empty object, hang the ExplosionForce component, and set the fragmentation blasting force Force to 200and the radius to 10.

The effect is as follows:

7. Break and break again: ExplodableFragments

Add ExplodableFragments components to the teeth.

Click the Generate Fragments button of the Explodable component again.

The running effect is as follows:

The above is all the contents of the article "how to achieve the effect of arbitrary shape broken fragments in Unity2D pictures". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Effects components pictures shapes fragments articles fragments content polygons engineering buttons types learning blasting generation collision run not much interest radius Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Microsoft Huawei Apple NVidia