(click images to enlarge)

A script I made in maxscript to quickly fill vases and jars. Useless, but pretty to watch and fun to code.

 

 

First the flowers and their collision meshes, and the vase get generated.

Then they get dropped in the vase using MassFX.

Finally they get converted into objects that won't be affected by MassFX.

 

 

The user can choose between 3 different pre-modeled vases to generate: box, round or classic.

 

 

There are 3 pre-modeled flowers to choose from, and then there are 3 more custom options. The user can modify the amount of flowers they want to spawn in, and the minimum and maximum value of the bend on the flower.

 

 

There are 3 custom flowers. The first is the default, made up of boxes and a cylinder. The second flower is a custom mesh the user can choose. With the third flower, the user can pick their own petals and stem. In the example image above, the composite flower is made up of spheres and a pyramid.

With the default and the composite flower, the user can input the amount of petals, and the minimum and maximum bend on those petals.

 

 

The user can choose the colors for the stem and the petals. A Multi/Sub-Object material is generated and added to the flower. The petals and the stem are each assigned different material IDs. This is available for every flower except for the custom -> pick flower option. I'd have to teach my script to understand the concept of a flower to make that dream come true, and I'm not at that level yet.

 

 

Collision meshes are generated from the original meshes using an optimize modifier. Then they are assigned to the massfx_rbody modifiers of those meshes.

The center of gravity of the flowers is moved to the base of the stem so they won't tip over.

From the edge of the vase a funnel is generated to ensure the flowers don't land next to their target. The script checks the normals of the vase for upwards facing ones that are located above 90% of the vase height. Custom vases aren't currently implemented with a pickbutton, but the user could overwrite one of the premodeled vases with their own mesh and have the script still work fine.

The timeline can be reset to the values it had before the user ran the script, in case those settings were important.

 

 

When the simulation is finalized, the script copies the initial flowers to new meshes without any MassFX information. The user can then delete the leftover MassFX meshes.

 

 

Ta-da!