Hi, I've been away for a very long while (long story). Anyhow... in light of the Voronoi Shatter Python script posted on CGTalk by davegreenwood (see
CGTalk thread or
get script on HighEnd3D, or
view some quick tests done with Dynamica), I'm uploading some quick RBDTools updates to allow Dynamica users to easily create and bake using Dynamica (Bullet Physics plugin for Maya).
I've updated the Bake script (dynamicaBake.mel). It will still allow you to bake all Dynamica primitives (spheres, cubes, planes; passive or active, stand-alone or arrays) and now as well it will allow you to bake all hull and mesh rigid bodies, stand-alone or arrays, that have been created using the "EasyBake" script (see below). I've also added an option to turn off the undo buffer to save memory if needed (use this option with caution). Make sure the simulation window is in focus during the baking process. You can stop the baking at any time by pressing Esc, what has baked up to that point will be preserved.
I've added a new "Create Dynamica Hulls and Meshes for EasyBake" script (dynamicaHullMeshForEasyBake.mel); it allows you to create hull and mesh rigid bodies that can later be easily baked (using the bake script) and / or rendered. The principal for "EasyBake" is fairly simple: a copy of the original mesh is used to create the Dynamica collision object and then the original mesh is preserved and made a child of the Dynamica rigid body. You could also do this yourself, however this script does more: it will shrink the rigid body collision object's shell (all of its vertexes) to effectively eliminate the collision margin from the original mesh's surface. Therefore when objects are stacked there will not be explosions nor will there be gaps between them. Also, if you load Maya BonusTools' measure.dll plugin, EasyBake will assign a different mass to each object relative to its volume. I didn't make a UI prompt for the mass range (more can be done, in fact probably want to prompt for density of the object), if you want to change it, check the script. (Note: with bullet, try
not to place small mass objects under large mass objects on a floor, that is an explosive recipe.)
This script will only work on discrete polygon objects, don't run it on groups / structures or other types of geometry.
I also updated the Toggle Visibility script (dynamicaToggleVisibility.mel). It can toggle visibility of both the collision objects or the entire rigid body now. Note that currently with Dynamica, when no rigid bodies are visible at all the simulation is disabled, this is useful when reviewing baked results.
To use these scripts, simply source them from Maya's script editor, or place them on a shelf. I did them fairly quickly, so I haven’t tested every scenario (save your work). They all have some sort of UI.
The basic workflow is:
- Using Dynamica's menu, create the primitive rigid bodies you need (a passive plane for a floor is always a good start). Do not create hull or mesh rigid bodies using Dynamica's menu.
- Select the poly objects you would like to convert to hull or mesh rigid bodies, then run the "EasyBake" script to convert them to rigid bodies. (Always favor using a rigid body hull over mesh, convex hulls are much faster and much more stable than meshes, convex or not.)
- Rewind the scene (resets Dynamica's state and rigid bodies).
- Play and adjust the simulation until you are satisfied. (Be careful to select and move the rigidbody parents, not the child polys)
- Use the Bake script to bake the simulation.
- Use the Toggle Visibility script to hide all Dynamica rigid bodies while you verify your baked results.
- If you like the results, you can then delete the Dynamica rigid bodies and render; if not, then you can delete the baked results and use the Toggle Visibility script to make all rigid bodies visible again.
Here's a quick "how to" use davegreenwood's Voronoi script with Dynamica:
- Create a poly object (try a simple one at first, like a cuboid).
- You then need to create a group of locators to tell the Voronoi shatter script the location of each shard generated by the shatter.
- Instead you can simply let the script create a group of locators for you from particles using a Maya emitter. To do this, place a Maya emitter in the scene and shoot particles at / into the poly object you just created. Don't shoot too many particles or have them packed too densely because each one will represent one shard in the shatter. To start, keep the number of particles very low. Run the Voronoi Shatter script UI, set the mesh object (your poly object) and set the particles by selecting them then pressing the set button.
- Select the "Constrained Particles to Locators" button. The script should create a group of locators from the particles that exist only inside the poly object.
- Set the Crack Width to 0.0.
- Do the Voronoi shatter.
- Place the group where you want it in the scene before converting the shards to rigidbodies.
- Select all of the individual shards (not the group!), then run the "EasyBake" script to create dynamica rigid bodies with all of the shards. When prompted to "Center pivots?", select yes!
- Rewind the scene (resets Dynamica).
- Play.
p.s.: Note that the difference between an active Dynamca rigid body and a passive one is simply: if mass = 0 it's passive.
(edit: re-uploaded fixed dynamicaHullMeshForEasyBake.mel to unparent objects)
You do not have the required permissions to view the files attached to this post.