Create a decomposable logo

Hello guys,

I would like to create a decomposable logo in Unity.
By “decomposable logo”, I mean a picture made of many little squares (like pixels) that I could dynamically destroy with any kind of colliders.

To illustrate what I’m asking, I made this pro quality drawing :

So if I have a shape made of those tiny little square and if a collider collide with the shape, I would like the little squares to get away from their initial position.

Any idea on how I can achieve this ?

  1. Create a logo from lots of little squares in Unity or 3d modelling package
  2. Attach BoxCollider (or BoxCollider2D) to all of them. If you want physics, then attach Rigidbody too.
  3. Probably turn off gravity
  4. Probably make them to not collide with each other using collision matrix
  5. Tag them (i.e. “LogoPixel”)

Then it depends on if you want to squares react to any colliders or if you want very special collider which affects any rigidbody or just any pixel from the logo

  1. Create either LogoPixel component (and attach it to every pixel) or LogoEffector component (and attach it to any collider you want to use as effector).
  2. Implement it logic using callbacks defined in MonoBehaviour. See Unity - Scripting API: MonoBehaviour.OnCollisionEnter(Collision)
    and Unity - Scripting API: MonoBehaviour.OnTriggerEnter(Collider) and its 2d counterparts (like Unity - Scripting API: MonoBehaviour.OnTriggerEnter2D(Collider2D))

You should detect a collision (by implementing callback in component), understand if you collide with right object (check its tag for example) and implement animation logic by using methods defined in RigidBody (like Unity - Scripting API: Rigidbody.AddForce)

Feel free to ask additional questions at any moment.

1 Like

alternatives: (not tested)

  • create custom (high res) mesh plane from quads (not sharing vertices)
  • when something hits the plane, remove wanted quads from the main mesh
  • and spawn them as separate quad meshes, with own collider and rigidbody if needed
  • need to copy UV information also, so that the texture will match on broken pieces *unless each quad is just one color

also nice effect here, there might had been couple other similar ones:

Thanks for the answers !
Yesterday, I tried the Atomizer mgear just mentioned and it works great, I now have some pretty cool effects with what I wanted to do.

I’ll probably try mholub solution as well, but I don’t know how I could create my logo with a lot of little squares, since placing them one by one with Unity sounds really tedious.