Synchronizing Child Animation

Options
Hi,

I have an agent that I want to synchronize using the Transform View and Animator View. The parent/root is the agent and has the Transform View component attached, however: the actual animated agent(s) are children of this root object. Can you advise the best approach to synchronizing the animation for the child?

Do I need to modify the 'Photon Animation View' for this case or is there already a way to handle these kinds of setups?

Any help offered would be much appreciated.

Answers

  • TetraGames
    edited September 2017
    Options
    Hey @pHrEaKzOiD ✭,
    I suggest you do not sync the animations. Just predict where character is heading or is he jumping etc and play it on local side.

    I manage that like this and it seems working fine!

    void PredictAnimation()
    {
    if (previousLoc == Vector3.zero)
    return;

    Vector3 pos = transform.position;

    // if player is in air dont play animation
    if (!character.isPlayerGrounded)
    {
    StopMovingAnim();
    return;
    }

    if (pos.x > previousLoc.x) // movinRight
    {
    animState aState = tag == "blue" ? animState.forward : animState.backward;
    character.animator.SetBool(aState, true);
    }
    else if (pos.x < previousLoc.x) // movinLeft
    {
    animState aState = tag == "blue" ? animState.backward : animState.forward;
    character.animator.SetBool(aState, true);
    }
    else
    {
    StopMovingAnim();
    }
    previousLoc = transform.position;
    }


    Have a nice work.