meshmash / Plankton

A C# half-edge mesh data structure, and components for using this in Grasshopper/Rhino
http://meshmash.github.io/Plankton
GNU Lesser General Public License v3.0
216 stars 66 forks source link

Plankton Meshes for Unity? #49

Closed mmedinav18 closed 5 years ago

mmedinav18 commented 5 years ago

Hi,

I started using the Plankton library for Unity as part of a bigger project that I started in unity. My question is if Plankton Meshes are able to convert to unity meshes for visualization? Is this possible? As of now, I am just simply creating a simple plane mesh from scratch. I am also new at c# and unity so my apologies if my question is a very obvious one to resolve.

Thanks in advance.

pearswj commented 5 years ago

To answer your question simply, no, Plankton doesn't include a way to convert to a Unity mesh. It should however be straightforward to write your own conversion. I don't know Unity myself, but I took a quick look at their docs...

This code is just to give you an idea. None of it has been tested!

One thing I noticed by reading the Unity docs for their Scripting API was that Unity meshes are triangulated. Plankton supports n-gon faces, so you might need to triangulate your mesh before converting it to Unity (one option is Stellate()).

Good luck :)

mmedinav18 commented 5 years ago

That's what I though. I was looking more at visualizing just quads instead of quads that are triangulated, but this helps. Thanks @pearswj!

adamgryu commented 3 years ago

I created a fork with some changes and tools to integrate with Unity here: https://github.com/adamgryu/Plankton-Unity I just wanted to share this in case it's helpful!