Search Unity

Cancelling MatchTarget? / Mecanim + Object pooling?

Discussion in 'Animation' started by bluescrn, Oct 23, 2013.

  1. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    559
    Hi,

    I'm using the MatchTarget functionality to make a character jump animation move the character to a chosen landing position. This works quite nicely.

    But I need to be able to cancel this target matching.

    If a character is killed during a MatchTarget jump, the animator is disabled and the character is ragdolled, then returned to the object pool, and I reset what I can, including requesting a transition back to my idle state.

    But when the character instance is reused, the MatchTarget blend is still running, which can send characters sliding across the level in very undesirable ways...

    Is the MatchTarget actually supposed to continue running after a transition into another state? - it's a bit of an unusual case, but it makes no sense for the target matching to continue if we've jumped out of the state that used it?

    (Edit: Just found the answer, there's an 'Animator.InterruptMatchTarget' that I'd missed - exactly what I was looking for)
     
    Last edited: Oct 23, 2013
unityunity