GithubHelp home page GithubHelp logo

swordlegend / boom.unity Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oskarsigvardsson/boom.unity

0.0 0.0 0.0 56.99 MB

Destruction effect in unity

License: MIT License

C# 59.61% GLSL 40.39%

boom.unity's Introduction

Simple destruction effect for Unity

Demo

I had a silly idea of how you could do a destruction effect in Unity, and this is the result. The idea is to generate a Voronoi diagram for the wall, apply a few rounds of Lloyd relaxation, and then generate meshes from the cells which becomes the "shards" of the wall. UV coordinates are also assigned to the front faces of the shards to make up a continuous texture, but that part could be much improved. The shards are created in Start() and are all kinematic Rigidbodies.

When you "shoot", a raycast is sent to the backwall which is the origin of the explosion, and all the shards touching the explosion radius become non-kinematic and has an explosion force applied to them.

There are many optimizations one might do for this, but the frame-rate holds up even on my ancient MacBook Pro. Since this was just a quick project, I didn't clean up the code too much and haven't made extensive comments, but would be happy to do so if requested.

To generate the Voronoi diagram I use the this library for c#, as experience have taught me that reimplementing Fortune's algorithm is no fun :)

boom.unity's People

Contributors

oskarsigvardsson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.