Home Technical Talk

Advanced Skeleton For Root Motion?

rockbox
polycounter lvl 6
Offline / Send Message
rockbox polycounter lvl 6
Could someone share their workflow for Advanced Skeleton when working with root animation for game engines?

A common setup (if not the only, correct way) for a rig that will use root motion is to have the root bone at (0,0,0). Next would be the pelvic bone, which in Advanced Skeleton is named "Root". I've found that the way to add the best way to add this bone is to add it to the fit skeleton and then build the rig after. The rig builds seemingly as it should, however, when I try to move the new root bone, which is at (0,0,0), it moves by itself and the skeleton doesn't follow. I think this may just be a constraints conflict with the "Main" controller, which controls the entire rig, but I have little experience with root animation for games and none for Advanced Skeleton.

Replies

  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    That sounds like a parenting issue.
  • Mark Dygert
    So this is kind of tricky but I got it working with Unreal and should work with other games. 

    You are totally on the right path, but there are quite a few little steps you have to take since the rig isn't really meant to work with games, there are a bunch of end joints you don't need and cause issues in engines, and yes you do need to reparent the root. 

    I rig in 2 separate maya files. A AS5 friendly version "1_Builder" and a version "2_ForAnim" that has been altered, I reference this into blank scenes to do animations. If I need to make changes to the rig I go back to 1_Builder and redo the steps to get it ready "ForAnim".

    Building the AS5 rig (1_Builder_xxx.ma)
    1. On the fitskeleton, add a bone at 0 0 0, name it Root and rename the old root to Pelvis.
    2. Using AS5's Attribute tool, add "hipSwinger" to the Pelvis and turn it off in the channel box. You can leave it enabled, but it expects the root to be in the pelvis location but now it's between the feet and that caused some issues when animating the spine in IK mode.
    3. Save your file as 1_Builder_xxx. You'll come back to this to make changes to the rig, because the next few steps, break AS5.
    Modifying the Builder file, for animation (2_ForAnim_xxx.ma)
    1. Open 1_Builder_xxx and save as 2_ForAnim_xxx.
    2. Parent the Pelvis to the Root.
    3. Build the rig and run the first script "Rig_CleanAdvSkeleton.py". This will strip off the end joints, get rid of the fit skeleton and correctly parent/scale constrain the root to the desired parents.
    4. Save. Referance this file into a blank scene and you are ready to animate.

    To export animation.

    1. Grab the Root joint, select hierarchy, export selected as fbx.
    To make a Skeletal Mesh.
    1. Open the 2_ForAnim_xxx and run the second script "Rig_CleanAdvSkeleton_Rig.py". This will strip the rig down to just the mesh(es) and the deformation joints. 
    2. Export everything as fbx.

    Let me know if you hit any snags.

    Note: The forums won't let me post .py files so I had to attach them as .txt. Just change the extension or copy/paste the text into a new python tab.

    EDIT: Updated versions of the scripts found below.
  • rockbox
    Offline / Send Message
    rockbox polycounter lvl 6
    @Mark, Thank you very much for these clear instructions and scripts. The amount of time and effort saved using Advanced Skeleton is incredible, though I spent much of that saved time researching a fix for this issue and Animation Driven Locomotion in general, trying to learn a proper workflow. I'm not able to test your solution just yet, but later this evening I will and let you know how it goes.
  • rockbox
    Offline / Send Message
    rockbox polycounter lvl 6
    By the way, have you ever seen an error similar to this?
    Error: file: C:/Users/Shelby/Documents/maya/2017/scripts/AdvancedSkeleton5.mel line 2212: Object 'separator21' not found.
    I've only noticed it when I updated to the latest Advanced Skeleton, but after uninstalling Advanced Skeleton and reverting back to previous version the error persists, though the Object that is not found is different sometimes. I just thought you might know.

    EDIT:
    Upon execution of Rig_CleanAdvSkeleton.py, nothing seemed to happen. The FitSkeleton still exists and there's no apparent visual difference. I assume the end joints are all the last joints in the chain, e.g. finger joints sitting outside the mesh? Those are still there after running the script as well.
  • Mark Dygert
    I have seen that error, it usually means that there was some fundamental change to the rig that it couldn't reconnect an orphaned piece. Most of the time it build ok and it's just a warning, if it doesn't build ok, I export the fit skeleton, save out the skin weights (export) and then load the mesh into a new scene, load the fit skeleton, rebuild, rebind and load skin weights.

    Ahh yea, the scripts have a main def called "start" and it needs to be called for the script to run. I normally do this from a custom UI that is loaded into Maya, it's easier to hit a button than to run a script... but for stand alone scripts you can just add at the end of the script a new line and put "start()".

    OR...

    Grab these, I added it to them ;)
  • rockbox
    Offline / Send Message
    rockbox polycounter lvl 6
    I for some reason still get that error nomatter what, along with another about how it can't find HIK or something (but error doesn't point to AS5 script).

    With the updated scripts I think it worked, but the end joints don't change. What version of maya do you have? I'm using 2017 and I could send you the file ready for animation if you're using that as well.
Sign In or Register to comment.