Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report