Hi, I’ve been trying out scripts to create metaballs and be able to move them around. The one on the Wiki would let me move the metaballs around. If some one could help me create metaballs that I can move that would be great!
Thanks
Hi, I’ve been trying out scripts to create metaballs and be able to move them around. The one on the Wiki would let me move the metaballs around. If some one could help me create metaballs that I can move that would be great!
Thanks
Depending on whether you want your metaballs to function in 3D or 2D, you will want to use different methods.
In 3D, I would strongly suggest the marching cubes algorithm, and build up the mesh based on the faces generated by said algorithm (this is how the script in the Unify Community Wiki does it).
In 2D, it depends if you have Unity Pro. If you do, great. Just make a simple 2-poly plane mesh and attach a radially decaying particle texture, and an additive-blended shader, and use a post-processing effect that would remove the excess alpha from the edges of the overlaying particle shapes that is below a specified threshold (a float between 0 and 1).
If you do not have Unity Pro, however, and want to use 2D metaballs, this gets a lot hairier, and you’d do best to attempt implementing the marching squares or meandering triangles (though I’d suggest marching squares, as it is easiest to understand, IMO, and is a bit more similar to marching cubes than meandering triangles is) algorithm into Unity, and build the meshes for the individual particles, programmatically.
The downside to the second version of the 2D metaball system is that it is significantly less efficient, and a heck of a lot more difficult to properly implement.
However, some very basic alteration of the 3D version in the Unify wiki should yield a perfectly controllable 3D metaball system.
You should come back after you’ve given it at least a good once-over and have questions about something a bit more specific than “help me write this script” ;3