mjholtzem / Unity-2D-Destruction

MIT License
622 stars 98 forks source link

Diffuse Material #1

Closed ordiovince closed 8 years ago

ordiovince commented 8 years ago

Hello,

Is it possible to change the material used for the meshes created by your script? My games uses lights and diffuse materials for the sprites. I tried just changing the material (to "Sprites/Diffuse") directly in the code but the meshes are black and do not react to the lights.

I have no idea what's going on, I don't know anything about materials, shaders, meshes...

Thanks

mjholtzem commented 8 years ago

Hey sorry I'm just now seeing this. I'll take a look and see if I can come up with a solution for you :D

mjholtzem commented 8 years ago

Ok just committed a small update. The material you assign to the source object will carry over to the generated fragments. Textures are assigned assigned properly and normals are calculated. Let me know how it's working for you once you try it out.

I've added a diffuse sprite example to the main scene

As of now there's no support for normal or bump maps so those won't work. I may add that in the future though

ordiovince commented 8 years ago

Hi, thank you for the quick response.

I tried it, I still have some issues:

  1. On your demo scene, if you change the shatter type to "Triangle", the fragments are not lit properly 1 1 1 2
  2. When I try to use the "Voronoi" shatter type with a sprite that have a pivot point not in the center, the calculated fragments are not covering the entire sprite 2

I hope this is clear enough...

Thank you again for your work.

mjholtzem commented 8 years ago

Ok I've added support for pivot points and triangular fragments should light properly now. Let me know how it works for you

ordiovince commented 8 years ago

Hi,

Everything is working just fine now, thank you very much for your work and your reactivity.

Keep up the good work and thank you again, this is a great asset.