Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

should i use the object with the Animator component as the main object or a child for a main parent

Discussion in 'Animation' started by Aladine, Apr 23, 2020.

  1. Aladine

    Aladine

    Joined:
    Jul 31, 2013
    Posts:
    195
    Hi everyone,

    Since i started using unity professionally (~7 years ago) this has always been my character setup:
    , the "Player" object will have a bunch of components depending on the game, and the Graphics child object will contain the graphic object with the animations and whatnot.


    Now this all work good with "in place" animations like a walking-loop so i can sync the animation speed with the "Player-Object" movement speed, but now am finding it difficult to use this system with a complex animation like a wall-climb: imgur mp4 link

    so i just wonder, is it a standard to have the main character object be the holder of the "Animator" that is responsible for the movements ? i don't know why but i always felt like this would be a bad way of doing it it and that the animator should always be treated as a sub-component and not a main one.


    Finally i would love to know if there is any good tutorial about this topic, i did some research on root motion animations but they all show an example of setting up the animation and using it which is something that i can figure out on my own, what i want is a "real-project" example and how the final setup looks like, (i don't mind if the tutorial is a premium one for example in unity learn)



    Thanks
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,580
    I've always found it more useful to have the Animator/model as a child of the Physics and core logic because it lets you easily swap it for a different model without losing any of your components except stuff you need to attach to bones.

    Redirecting Root Motion from the Animator to a different object is really easy. The Root Motion example in my Animancer plugin explains how to do it (without Animancer you would just reference the Animator directly instead of an AnimancerComponent).

    You might also like to read the Full Movement Control section in the 3D Game Kit example which explains how you can avoid one of the main problems with using root motion.
     
  3. Aladine

    Aladine

    Joined:
    Jul 31, 2013
    Posts:
    195
    Hey i was actually looking into Animancer today! (found out about it after searching for another issue i've been having [making a combo system] )

    Also yeah, the keep my Animator/Model as a child of the Core object for the same reasons you stated above.



    So today i bought this Gunslinger animation pack, and was hoping to just break some of the animations there (the cool looking combos in his video are actually one long Animation and not a combination of a many), so i started breaking them down and starting the setup, and OMG am starting to bang my head on a wall on how tedious the state machine workflow is, the re-arranging, the straight line (its been what 6 years now and still doesn't have "curved" lines ?), the grouping (sub-state) just fine but it would've been better if we could've had an "expandable" one like most shader editors , has.

    anyway, i can keep ranting about this for days lol

    I just bought Animancer Pro tonight, will play with it in the morning, but if you have any advice on how to proceed with making a combo system then please let me know, i know its off-the root motion-topic, but it would be helpful :)
     
  4. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,580
    The Weapons example should be exactly what you're looking for.

    At least they finally managed to get states to align to the grid ...

    Baby steps I guess.
     
  5. Aladine

    Aladine

    Joined:
    Jul 31, 2013
    Posts:
    195
    oh that's cool!

    is there a reason though why of all the examples in the imported package, the "05 weapons" folder doesn't actually contain the example scene ?
     
  6. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,580
    Yes, the first paragraph in the documentation explains why.
     
  7. lejean

    lejean

    Joined:
    Jul 4, 2013
    Posts:
    392
    I was also looking in to this because I've just been using the character FBX's as the root for the prefab but it seems that if you expose bones in the rigging options, the prefab doesn't get updated.

    This is a problem because then I'd have to remake the prefab every time for a change.
    Making it a child might be easier to update your character with a different mesh or what not.
    Edit: It seems that you have to make a prefab variant instead of an original prefab if you want the link to your original mesh maintained.

    There's 1 caveat to parenting your FBX though.
    When I was working on a online multiplayer game I vaguely recall an error that said "Your character's navigation should be the root of your game object" or something along those lines.

    That was a couple years ago though.
    I don't know if that's still the case but that might be something to keep in mind.
     
    Last edited: Jan 5, 2021