Irin1178

So I've tried both approaches, using SkeletonAnimation and Mecanim. I have a simple test I'm trying to complete. I have a walk animation cycle with a character that blinks rapidly. I have a separate blink animation with a normal once every 2 seconds blink. I want to see the character walk and blink normally. I.e. perform an animation override when combining animations.

With Mecanim: I've set my base layer to loop my walk animation, my second layer to loop my blink animation with a weight of 1. Then on my SkeletonAnimator script, I set my two mix layers to [0]: Always Mix, and then [1]: Spine Style. Though it doesn't matter what I set these too, it always will add the two animations instead of overriding the eyes with the blink animation.

In the SkeletonAnimation approach, I wrote a simple script that would call skeletonAnimation.state.SetAnimation for my walk and blink, this way they should both be weighted to 1. I also made sure the animations were being played on separate tracks. I still end up with a mix of the two animations. Another interesting note, my root bone animation no longer works after setting the second animation.

As for specs, I'm running Unity 5.3.0f4 on a PC durring these tests. My target platform is set to android.

I'd love to know if anyone is able to get Animation overrides to work and how.
Irin1178
  • Mesajlar: 2

Majicpanda

Do you have key frames set for your eyes on your walk animation? If you want to try to use mecanim layers and play both over the top I think each animation needs to ensure there are no key frames for the same bones or else they might fight each other.

I think the idea is to have zero key frames in any of your animations for eyes and then have a totally separate animation for EyesCalm, EyesExcited, EyesBlinking etc and play one them for example on the second layer in mecanim at all times.

I've asked a ton of times on this subject and have yet to get it to work because it would require a lot of animation rework in spine, but hopefully you can play around since you're just starting.
Majicpanda
  • Mesajlar: 197

Irin1178

What you're describing would be an additive setup. Where I am trying to do an override setup, the keyframes of my eye animation should take presidence over the keyframes set on my walkcycle animation.

Also, I know its absurd to be doing this with eye blinks. Its just a simple test of the animation system we would likely need in other use cases, like a character waving mid walk cycle.
Irin1178
  • Mesajlar: 2

Majicpanda

Someone else should definitely reply, but I wasn't aware of Spine being able to support complete overrides. It was my understanding you had to key frame everything properly.
Majicpanda
  • Mesajlar: 197

Pharan

I'm not sure what the difference is between "Additive" and "Override" but there's a known non-overriding behavior in Attachments. They used to work like curve timelines but right now, for performance reasons, they work like event timelines. Attachment swaps only happen when you cross the key, and not every frame between it and the next.

You can change this behavior to do overriding like normal curve timelines (position, rotation, scale) by removing/commenting out one line from Animation.cs
This line: https://github.com/EsotericSoftware/spine-runtimes/blob/master/spine-csharp/src/Animation.cs#L451

The Spine runtimes are going to be updated soon so you may need to do this again after the update.
Performance aside, if you need that behavior, just do it this way. It won't be awfully costly unless you spawn lots and lots of skeletons.
Kullanıcı avatarı
Pharan
  • Mesajlar: 5366


Dön Unity