[Unity 3d] Unity 中破坏物体 - GitHub

实现基于 Delaunay 网格分割算法的破碎效果。

GitHub 上的工程多如繁星,有些好的仓库,但凡不经意间错过了就很难找回,故稍作采撷,希望能帮助到有心人。

简介:

笔者今天推荐的仓库叫 unity-delaunay。 - delaunay网格分割算法 for Unity

功能:

实现基于 Delaunay 网格分割算法的破碎效果。

使用:

I’m generating the Delaunay triangulation using the incremental algorithm (Bowyer-Watson), and generating the voronoi diagram from the delaunay triangulation. You can also clip the voronoi diagram to any convex shape (it uses Sutherland-Hodgman clipping, adapted to voronoi diagrams).

The fact that you can clip to any convex shape is neat, because it means you can “recursively” generate voronoi diagrams, so you can shatter already generated voronoi shards.

All the “generator” classes (the delaunay generator, the voronoi generator, and the voronoi clipper) are designed in such a way as to not generate any garbage if they are reused (though I’m currently not doing that in the example code). If you were to do this in a real game, it would be suitable to run the generators on background threads, though they’re certainly performant enough to run in real time in a single-threaded environment.

I was going to develop this a bit further, but the limiting factor in this kind of destruction effect is the physics. If you generate these kinds of shards and let them pile up, the physics engine basically implodes. Given that that was the limitation, I sort-of lost interest in the project. As such, the non-Delaunay/Voronoi parts of the code are super-unoptimized and kind of a mess :)

哈哈,自己翻译。。。

演示:

Delaunay

链接:

OskarSigvardsson/unity-delaunay: A Delaunay/Voronoi library for Unity, and a simple destruction effect

2020年11月4日 更新

新增OskarSigvardsson/quickfracture: A real-time destruction effect for 3D meshes, written for Unity

QuickFracture

2020年06月28日 更新

新增
ElasticSea/unity-fracture: Fracture any mesh at runtime

结语:

  • 非常适合做情绪倾泻小游戏,哎呀,看着看着绝对能治愈俺的强迫症...
  • 加班中,避免断更,文章有点乱后面会再整理。。。。

本文集持续更新ing,喜欢记得点赞关注哦!

你可能感兴趣的:([Unity 3d] Unity 中破坏物体 - GitHub)