Tuesday, August 13, 2013
Automatic Phys-Proxy Generation
Automating this process is a no-brainer!
For most things capsules work the best, but you can also apply this concept to use cubes, spheres or a teapot if you like.
The script I am providing takes a joint and its first child to align the rotation. If you have multiple children, just unparent them temporarily to make sure the correct one is being used.
It will then measure that distance between those joints to use it as the length of the capsule.
The radius of the capsule will be calculated by taking the influenced vertices of a joint and average the distance between each of those to the unitvector of the joint orientation. So it really depends on the geometry and how precise your skinning is. In most cases this works pretty good though.
So run the tool, select your skinned mesh and click define mesh. This will provide us with the volume of the mesh to calculate the radius of the capsule. Then select a joint, and press create capsule and it will create an optimal fitting capsule oriented along your joint.