Search Unity

  1. Unity 2020.2 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Help Wanted Object position changes during transitions in preview

Discussion in 'Timeline' started by HeyBishop, Nov 26, 2020.

  1. HeyBishop

    HeyBishop

    Joined:
    Jun 22, 2017
    Posts:
    169
    Looks like there are a lot of similar queries in the forum - but not exactly (as best as my searching has concluded).

    I have a third-person character, and some animations I want it to play in succession, slightly blended.
    • The transform of the character is (0,0,7.5).
    • I've created a Timeline on an empty gameobject at (0,0,0).
    • I dragged the character (which has an animator) into the Timeline window, and created an Animation Track.
    • I then drag and drop my first animation, called SleepingIdle.
      • So far so good, in preview and play mode the character is sleeping.
    • Next, I drag in my second animation, called StandingUp and snap it beside the first animation.
      • This previews/plays fine too.
    • I blend the two animations.
    This is where the troubles begin: when I preview the transition between these two animations, the character snaps over to what seems to be a position of (0,0,0). It seems to snap to (0,0,0) no matter what the Timeline gameobject's position is.

    In play mode, the transition works as expected.

    Is this a bug?

    Here is a demonstration of my problem:


    This problem exists in Unity 2020.1.13f1 and 2019.4.12f1.
     
  2. HeyBishop

    HeyBishop

    Joined:
    Jun 22, 2017
    Posts:
    169
    I tried recreating the problem again... but it seems to be inconsistent.... and weird:
     
  3. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    375
    Extremely weird.
    Can you file a bug with your scene added to it? I'd like to inspect your clips.
    If you do so, please give report back the bug number here so I can look at it before it goes through the QA pipeline.
     
  4. HeyBishop

    HeyBishop

    Joined:
    Jun 22, 2017
    Posts:
    169
    Uploading my bug report now!
    Gosh, I didn't realize it was going to upload the whole thing. Do you need all 6.25GB? (Asked while still at 1% complete)
     
  5. HeyBishop

    HeyBishop

    Joined:
    Jun 22, 2017
    Posts:
    169
    The upload failed - so I tried again without the entire project. I did, however, include the scene file and animation clips. The issue is recreatable with any Synty Studios character (haven't tried other publisher's characters yet, come to think of it).

    Awaiting bug number.
     
  6. HeyBishop

    HeyBishop

    Joined:
    Jun 22, 2017
    Posts:
    169
    I didn't receive an email with a bug report number - should I have?
     
  7. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    375
    You should I think.
    Do you remember what you put as a title?
     
  8. HeyBishop

    HeyBishop

    Joined:
    Jun 22, 2017
    Posts:
    169
    Yes, I used the exact same as this thread: "Object position changes during transitions in preview"
     
  9. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    375
    1295759
    Looks like our QA incoming department has a large backlog. The link for the bug should be generated later.

    Sadly, I can't use the scene or controller files without the relative links to the other assets.

    You can extract your scene by using Export Package from the right click menu on your scene.
    It's not the end of the world if it's picking up all your scripts.

    I have responded to you through the bug, you can respond and attach the .unitypackage in the email I think
     
  10. HeyBishop

    HeyBishop

    Joined:
    Jun 22, 2017
    Posts:
    169
    Sorry - got taken away from gamedev'ing this week. Just catching up now.

    I still don't have any emails confirming the submitted bug report... nor can I find it when searching for 1295759 on the issue tracker site.

    What I'll do is WeTransfer the exported .unitypackage, and share a link via a DM.
     
  11. HeyBishop

    HeyBishop

    Joined:
    Jun 22, 2017
    Posts:
    169
    I may have figured it out...
    I have a script that is fighting for control over the animator. Confirming now....
     
  12. HeyBishop

    HeyBishop

    Joined:
    Jun 22, 2017
    Posts:
    169
    I'm wrong. Disabling the competing component "MAnimal" does seem to help with playback issues in play mode, but preview still behaves the same.
     
  13. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    375
    The Animator has some code that does pattern matching for Avatars, where even if the path doesn't quite match, it can resolve it. It seems that there's an issue while blending two clips where the position gets reset to zero when you use this.

    To avoid issues, you should put your Animator at the root of your character Avatar (in this case
    Character_Female_Pirate_01(fixedScale)
    ). We may be able to fix this issue, but that pattern matching code will probably cause you other issues in the future.

    As for the character falling: this is caused by the RigidBody. You should animate it to isKinematic = true while Timeline is active to avoid this.

    We will investigate the issue further to figure out why it's getting reset to zero.
     
  14. HeyBishop

    HeyBishop

    Joined:
    Jun 22, 2017
    Posts:
    169
    Thank you!

    I believe the falling is happening because there is a capsule collider attached to my camera (at zero), so when the position gets changed to zero - it does what it's supposed to do with colliders/rigidbody.

    @Malbers, is it possible to use an animator on the character mesh (which is a child) instead of the parent where MAnimal sits? When I switchanged the animator reference (MAnimal>Advanced>References>Animator) it doesn't behave properly.
     
  15. Malbers

    Malbers

    Joined:
    Aug 7, 2015
    Posts:
    2,248
    The MAnimal Component needs to have the Animator on the same hierarchy level, since I use Internally OnAnimatorMove(). and without the Animator, none of the code inside that method will be executed
     
  16. Malbers

    Malbers

    Joined:
    Aug 7, 2015
    Posts:
    2,248
    Actually I had the same issues for a while and it seems that it has something to do when OnAnimatorMove() is used.
    So I've created a Fixer Script for that case:
    AnimatorMoveTimelineFixer.cs

    Which basically gets executed in Edit Mode and restores the built-in RootMotion using OnAnimatorMove.

    Is a super weird bug.

    So when you are using Timeline add that script to your character.

    That script it will be destroyed OnPlayMode, so it does not interfiere with the other Scripts OnAnimatorMove code

    Code (CSharp):
    1. /// <summary>
    2.     /// This is used for all the components that use OnAnimator Move... it breaks the Timeline edition
    3.     /// </summary>
    4.     [ExecuteInEditMode]
    5.     public class AnimatorMoveTimelineFixer : MonoBehaviour
    6.     {
    7.         public Animator anim;
    8.         void Start()
    9.         {
    10.             if (Application.isEditor && Application.isPlaying) Destroy(this);
    11.         }
    12.  
    13.         private void OnAnimatorMove()
    14.         { if (anim!= null)  anim.ApplyBuiltinRootMotion(); }
    15.  
    16.         private void Reset()
    17.         { anim = GetComponent<Animator>(); }
    18.     }
     
    Last edited: Dec 9, 2020
    HeyBishop likes this.
unityunity