Over the past couple of months, I’ve been working on a plug-in for Maya that allows users to easily create mathematically convex hulls around their meshes in Maya (primarily for collision creation). I’ve released the source as well as few example scripts up on github here:
It should be as pipeline agnostic as possible, and is covered under the MIT license - which means your legal team should no problem with you using it (or even modifying it). Let me know what you think!
Basically, you connect the output of one or more meshes into the inputs of the hull node. Then connect the output of the hull node into inMesh attribute of an empty mesh node.
You can use the included scripts and attribute editor for the to do the above, or you can write your own script and put it into your pipeline however you like. There is example code for both.
in cases where i want multiple hulls for one mesh to better fit the mesh, would i just do a componet connection too, than use multiple ddConvexHull nodes and multiple output meshes?
BTW, after your last post, I updated the utils script to add a “createHull” function. Not having that function was an oversight on my behalf (I guess I was just too excited to get it out to folks!)
You can snag the updated version here:
One last thing, if you don’t delete your history, that mesh will update as you move your object around. If you do delete your history, you’ll lose the dynamic updates, but the resultant hull will still be cached and saved in the mesh nodes.
Let me know if you have other questions or feedback (or if you want to contribute)!
-J
ya don’t think i will directly change it being more of a python guy not a c++ guy, but i might work it into some scripts i use for export to various game engines.
if i did so, would you care if i bundled the binary for it? and credit you or would you rather i just put a link to it in the readme?
Thank you very much for sharing this. Any chance someone can compile a binary for Maya 2014? I don’t have a Visual Studio environment here to build my own. Thanks!
thats great, since while i was working on some unrealscript i hosed my vs2010 install with a add-on, so was going to take me a while to get it going again.
if i can get permission from the plugin maker, i may compile for 2014 64bit and 2012 64bit and host builds of it.
Here’s a quick shelf button Python script that will make a single convex hull from the selected meshes (or faces). Requires ddConvexHull to be installed on your system.
import maya.cmds as cmds
import DDConvexHullUtils
selection = cmds.ls(sl=True, l=True)
# Create the nodes
convexHullNode = cmds.createNode('DDConvexHull')
outputMeshNode = cmds.createNode('mesh', n='outputHullShape')
# Connect the input object(s) to the hull node
DDConvexHullUtils.addObjects(convexHullNode, objects=selection)
# Connect the output of the hull to the input of the outputMeshNode
cmds.connectAttr('%s.output' % convexHullNode, '%s.inMesh' % outputMeshNode)