Forum rules - please read before posting.

How to assign same parameters to multiple animators on different objects?

The player's clothing and body are out of sync when animated. ITHappy support had me separately attach the animator to every object, to coat, body, shoes, etc. but problem continued. Last advice was "currently you interact with only 1 Animator
you should repeat commands for animator to each Animator component on each "body part"". Has anyone experienced this?

Comments

  • A custom script could feasibly be written to transfer e.g. Int, Bool and Float parameters between Animators - but I'm not sure Triggers would transfer.

    Is this for a 2D or 3D game, and is the intent for the different clothing parts to be swappable? I wouldn't normally recommend using different Animators for different objects like that.

    As this is a visual issue, any screenshots you can share will help clarify the situation.

  • Hi Chris-
    I'm using the Morgue scene that you used in the 1st-person tutorial and am using a 3rd-person character from ITHappy's Medical Pack.
    This is how the characters are described on the Asset Store:
    • Characters (x24)
    Doctors, surgeons, nurses, infectiologists, EMTs, patients.
    • Assets for Characters (x124)
    Includes lab coats, shirts, T-shirts, surgical scrubs, pants, caps, masks, protective goggles, respirators, medical slippers, boots, gloves, and more. Syringes, clipboards, and other tools for customization.

    • 24 characters + 124 clothing items. The models include doctors, surgeons, nurses, infectiologists, patients, and EMTs (Emergency Medical Technicians). Characters come with separate clothing models that can be toggled on/off and customized to change their appearance. Includes 30 unique animations and is fully compatible with the Mixamo animation library, which features over 2600 unique animations.

    This is what the character looks like when I add an idle, Walk, and run animation controller. [link to image on Google Docs: https://drive.google.com/file/d/1NeKS0ZRbHXWBbd29ix51l56UHLFR4P9s/view?usp=sharing

    Vid clip of character animated:
    https://drive.google.com/file/d/1ebL3baF1ZfrQK2INKjBFrK1iuV0wEtbH/view?usp=sharing

    As you can see the character's body animates just fine but clothing does not.

    Screenshot of Animator I created using just 3 of the many, many animations:
    https://drive.google.com/file/d/1c-5kjFUov38Xnv8VA-Hjm2E1Nf6fvsFg/view?usp=sharing

    Screenshot of Animator that came with asset:
    https://drive.google.com/file/d/1C184qD2LWmVp0zKNmHH13asuAYRwtzh-/view?usp=sharing

    Appreciate any insight you can offer. Thank you - Jim

  • Where is the Animator that came with the asset placed? On each body part, or a shared root?

    Having a separate Animator on each body part is not the right way to do things - a single Animator, that affects all - is the standard way of working, not one specific to AC.

    But - to answer your original question - yes, it is possible to transfer an Animator's parameters through custom script.

    Here's an example script that can be used to transfer Float parameters to multiple Animators. Though, I would recommend working with the asset's author to get the character set up in the standard Unity workflow.

    using UnityEngine;
    
    public class TransferAnimatorParameters : MonoBehaviour
    {
    
        public Animator copyFrom;
        public Animator[] pasteTo;
        public string[] floatParameters;
    
        void Update()
        {
            foreach (var floatParameter in floatParameters)
            {
                float value = copyFrom.GetFloat(floatParameter);
                foreach (var animator in pasteTo)
                {
                    animator.SetFloat(floatParameter, value);
                }
            }
        }
    
    }
    
  • You asked: Where is the Animator that came with the asset placed? On each body part, or a shared root?

    Here are 2 screenshots showing that the character and the body parts are using the same Animator.

    https://drive.google.com/file/d/1YVwqeWP5eHQ2oBjFMwtsZVecLGKJvHqi/view?usp=sharing

    https://drive.google.com/file/d/1Ek7sITop4xpgqDxpDPrRDevn413j5UKo/view?usp=sharing

  • So the same Animator Controller is on both the root and its immediate children?

    Presuming its Animations affect a rig, it won't work that way - either the root, or its children, will respond - but not both. I'm only going by these screenshots, but it looks like an issue with the asset you're using.

    The above script, however, will transfer parameters from one Animator to others.

  • edited July 5

    Thank you for your input. I attached the script to the root and completed the fields re: the children via the Inspector [see screenshot] but clothing continues to have an "out of body experience :smile: "
    https://drive.google.com/file/d/1fcFbg1_yABxAQWNTntHcB-WI-BYaui3F/view?usp=sharing

    https://drive.google.com/file/d/1bGTlQ5P1iv3z2JlqarVcWdkwR__PovmK/view?usp=sharing

  • The component is set up correctly, but it's not clear from the screenshot what's changed. Are the clothes remaining in-place while the root moves?

    I'd imagine that with this set up, you don't want to rely on Root Motion in your Animators.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.