Advice for creating capsule colliders in Blender?

I’m implementing something like this:

http://www.anicombo.com/blog/?p=404

Box and sphere colliders are easy enough, but capsule colliders don’t use scaling the way the other two do. Do you have any advice on what the best Blender workflow for creating capsule colliders would be? I assume that it really would require some Python scripting, but I don’t have the time to learn that quite yet. Is the next best option just to use cylinders, and make visual estimations about how the rounded edges will translate to Unity?

I gave the script you linked to a quick look and from what I can see it checks the 3D model for name tags and if it sees that a model/part is named “C” it assigns a capsule collider to it. So you could use any mesh you wanted (box, human, etc.) and if you called it “C” this script would assign a capsule collider to it. Or did I miss something?

BTW - Pretty clever script.

Yes, but that’s not very useful, is it? The idea is that you model the actual shapes in an external editor, and have those shapes translate over as colliders instead of meshes.

Anyway, the solution I have come up with is to use mesh.bounds instead, and set colliders up based on the actual geometry, instead of local scale. It will solve the capsule collider problem, and also make it easier to deal with box and sphere colliders, because you can do mesh-level edits, instead of having to rely on object-level transforms. I will post it a little later.

(The actual editing of the capsule collider will have to be a mesh-level edit where you move the vertex group that represents the hemisphere at the end of the capsule, along the appropriate local axis. Scaling a capsule shape, unless you scale all axes the same, doesn’t result in anything too helpful.)

I just finished this up, and only tested it a tiny bit, so it may be a little buggy. The general instructions can be found here. The big additions for this version are support for automatic collider replacement, and allowing you to parent whatever you want to prefabs. Nobody is biting in that other thread, so I’m not going to bother making detailed instructions yet. It’s here if you want to play around with it, and I will answer any questions anyone has about it. I’ll be putting it on the wiki eventually.

204846–7551–$fbx_sync_351.unitypackage (6.13 KB)