Mirror animation tool

maxscript
max

#1

Hello, I just received a Task, I need to create a mirror animation tool in 3ds max,
the problem is that I’m not really comfortable with 3ds max and max script, I know only the bases
How would you proceed to do this,
even without script, how do you mirror an animation in Max


#2

I’d start by searching ScriptSpot and MaxPlugins to see if someone has already created the tool for you. Searching for ‘mirror animation’ on ScriptSpot generated 4 pages of results for me.

Don’t reinvent the wheel if you don’t have to.


#3

Thanks Jeff but actually as I feel more confortable with python I decided to use MaxPlus Python integration.
So with my tool I’m trying to acces values of the animation track
I found a way to get correct Animatable object
Animatable(Position/Rotation/Scale) but I cannot found a way to access all keys of the animation itself.
Can you put me in the right way?


#4

So I actually I found a work around and right now I’m stacked on another problem
How can I add a PositionList keeping the original PositionXYZ controller and adding a positionconstraint in the list?


#5

in case someone needs this, I ended up with this solution

def AddPositionListAndConstraint(node):
                #this method store the original PositionXYZ controller
                #and add it into the new listControl
                # to be safe this should be done for every child control
                positionList = mp.Factory.CreatePositionController(mp.ClassIds.position_list)
                positionConstraint = mp.Factory.CreatePositionController(mp.ClassIds.Position_Constraint)
                transformControl = GetTransformControl(node)
                positionXYZ = transformControl.GetPositionController()    
                positionList.AssignController(positionXYZ,0)
                positionList.AssignController(positionConstraint,1)
                transformControl.AssignController(positionList,0)
                return positionConstraint

#6

If you surround your code with 3 backticks `, your code will be formatted properly.


#7

I’m not sure if this would work the same way in Max but I don’t see why not. I haven’t used Max in years but in Maya, I wrote a tool to mirror animations that worked like this:

  1. First, put the animation skeleton under a new null/empty group node (which is created at 0,0,0)
  2. Set the scale of X in the new null group node to -1. This should create a mirror image of the skeleton. (Maya is y-up by default and Max is z-up, so you may have to do this on scale Y or whatever your sideways direction is)
  3. Save out this mirrored version of the skeleton and open a new file.
  4. In the new file, import a clean version of the skeleton.
  5. Using script, constrain the joints of the mirrored skeleton to the ones of the clean skeleton. But make sure that joints on the left side of the mirrored skeleton are constrained to their right side counterpart, and vice versa (because we mirrored the original skeleton and animation).
  6. If all went correctly, the mirrored skeleton should now be driving the clean skeleton, with the correct limbs being driven. Bake keys on the new skeleton and you should be able to remove the mirrored skeleton and constraints and see the same animation on the new skeleton, except the correct animation will be on the proper limbs.

Hope this made sense. I’m sure there are other better ways of doing the same thing but this was a quick and easy way I found.


#8

I don’t know how well it works in max, but for Maya we had a mirror tool that just took the curves from one side of the skeleton, and swapped them with the other. No re-baking, just a straight swap.

Each joint kept reference to its opposite using on an attribute, so the mirror tool would just grab the selected joints, find their opposites and handle the swap.

I honestly don’t know how Max works for animation, so no idea if this kind of functionality is possible / easy.


#9

I’m pretty sure you both have right.
I think in a default development environement this is the better solution.
But in my company we use an in house game engine that does not accept negative scale, that’s why I cannot just put everything under a dummy object and simply mirror.
In ended up writing a custom tool that bake all the animation into a non-negative version of the objects
Thanks anyway


#10

How can I close this thread?


#11

There really isn’t an option to “close” a thread. Instead they tend to peter out organically.

You can select a certain response as a solution to a thread, which gives an indication to future readers as to how it was solved. (Though usually its best if there is an actual solution posted, that others can act on)


#12

If you just want to stop getting notifications, you can turn them off at the bottom. Otherwise, this is an online discussion that others might refer to for years.

image