# Separate Mirrored mesh when exporting?

I've created a humanoid model that I'm exporting as an FBX for use in Unity. The model is composed of many sub-meshes, because I want the model to "explode" in the game, and send the individual pieces flying. So, for example, I have individual "Hand", "LowerArm", "UpperArm", etc objects in my model. Currently each object has an unapplied Mirror modifier to keep the model symmetrical.

The issue is that when exporting this model as an FBX, the "Hands" object contains both the left and right hands as a single object, as opposed to being separate objects.

A very manual way to address this is to apply all of my Mirror modifiers, then manually separate the vertices on one half of the model to a new object. The obvious downside to that is that it's destructive, and I can't easily edit the model anymore after doing that.

I was hoping there might exist a "separation" modifier, which could intelligently separate a mesh into two pieces depending on whether the vertices are on one side of the model or another. That way, the modifier would be applied on export, but I wouldn't need to apply my Mirror modifiers in Blender.

So, in short: Is there a way to export an FBX of my model that separates my current "Hand" object into "LeftHand" and "RightHand", without having to manually apply the Mirror modifiers, and manually separate the vertices?

Thanks,

-Dan

I suggest you name your mesh with the suffix .l since it is the left side which is modelled (even if there is a subdivision modifier).

Here are some manual steps.

1. Duplicate objects. ⇧ ShiftD
2. With the duplicates selected, mirror them ⎈ CtrlM, X.
3. Export as fbx but deselect apply modifiers.

Or use a short python script. (Paste this in Blender's text editor and click Run Script with the objects selected. The script will automatically remove the modifiers and create a duplicated mirror, even if the mirror axis isn't x.

If you're using a different naming scheme than .l/.r, change this line  new_obj.name = re.sub(r'\.l\.\d\d\d', '.r', new_obj.name).

new_obj.name = re.sub('left', 'right', obj .name) would replace left with right. (You would name everything with the left prefix beforehand (e.g. "leftHand".)

import bpy
import re
import mathutils

scn = bpy.context.scene
objs = bpy.context.selected_objects

for obj in objs:
new_obj = obj.copy()
new_obj.data = obj.data.copy()
new_obj.name = re.sub(r'\.l\.\d\d\d', '.r', new_obj.name)

for m,n in zip(new_obj.modifiers, obj.modifiers):
if m.type == "MIRROR":
axes = [m.use_x, m.use_y, m.use_z]
dir = [(1,0,0), (0,1,0), (0,0,1)]
for axis, direction in zip(axes, dir):
if axis:
new_obj.data.transform(mathutils.Matrix.Scale(-1, 4, direction))
new_obj.data.flip_normals()
obj.modifiers.remove(n)
new_obj.modifiers.remove(m)


To remove the duplicates created by the script and re-add the mirror modifier simply undo the actions of the script with a single undo step. ⎈ CtrlZ