Search Unity

Animator.Rebind() Resets all state, is there another way to change Skeleton?

Discussion in 'Scripting' started by tmcsweeney, Jul 22, 2014.

  1. tmcsweeney

    tmcsweeney

    Joined:
    May 24, 2011
    Posts:
    20
    For complicated reasons involving ragdoll blending I want to instantiate a new copy of a mesh's skeleton and then change the Animator component over to start updating the new skeleton instance while leaving the SkinnedMeshRenderer still reading from the old skeleton.

    Animator.Rebind() looks like it should do the ticket, but unfortunately calling it also resets EVERYTHING on the animator. It jumps back to time=0.0 on the default state and all animation parameters are reset back to their default values. This causes a massive glitch in the animation and undermines the seamless transition I'm trying to achieve.

    I know from experimentation that it is possible to seamlessly change which skeleton a SkinnedMeshRenderer is using by writing (carefully) to the RootBone and Bones[] properties, does anyone know if the same is possible with the Animator component?
     
    StasUnity97 and Hooshangi-reza like this.