- Home /
Mecanim transition to 'matching' position
Trying to understand how I'd do this correctly in Mecanim, preferably sans scripting (I'm experimenting with FSMs)
The case is as follows:
I have a big red button on the floor. Trigger on the button. Player enters the trigger, the button plays a "press" animation, IE the button shifts downwards. The player exits the trigger, the button plays an "unpress" animation, the button moves upwards.
The challenge I have is this: If the player moves off the button (let's say jumps) 1/4 or 1/2 or whatever of the way through the "press" animation, I'd like to transition to the matching position in the "unpress" animation - so if the button was 1/2 of the way down when user exited trigger, the "unpress" animation would start at 1/2. If the button was 3/4 of the way down, the "unpress" animation would start at 1/4: the matching "3/4 of the way down" position.
Is there a way to implement this kind of behavior in Mecanim?
I would have recommended doing this with linear interpolation rather than animation, if this is the effect you are trying to achieve.
Sure, I could do it with a lerp or a tween library, but I feel like there has to be a way to do it with $$anonymous$$ecanim. $$anonymous$$aybe a blend tree?
I guess you could do it with a blend tree and a float. I haven't used mecanim in a while.