- Edited
SkeletonMecanim MixModes confusion
Hi!
I am a bit confused to what Mix Mode to use in Unity on the Skeleton Mecanim.
The gif shows what it looks like mixing from "Idle" to "prone". To the left we see what it looks like in the Spine editor (and what I want it too look like in Unity), and to the right, Unity.
"Always Mix" gives the closest result in Unity, but to quote Harald (I know you are watching :smirk: )"In general it is not recommended to use "Always Mix" on the base layer [...] unless you know exactly what you are doing". The problem is I don't know what I am doing. The recommended "Mix Next" gives a .... not so nice result.
In Spine, the "idle animation" only has keyframes for what needs to be animated, e.g. the shoulders and hips. Nothing less, nothing more. In the "prone animation", there's only one frame, which has a keyframe on every bone to be able to set the character in that pose <
This is maybe where the problem lies? But this wasn't a problem in Spine, and this wasn't a problem when I was using Skeleton Animation a year ago and did stuff this way.
Thanks in advance, and the new beta looks awesome!
Which version of the spine-unity runtime (name of the unitypackage) are you using?
Do you use multiple animation layers here?
If you are using a single layer only, could you please send us a minimal Unity project that still shows the problem as a zip package, to contact@esotericsoftware.com. Then we can have a look at it.
Harald wroteWhich version of the spine-unity runtime (name of the unitypackage) are you using?
Do you use multiple animation layers here?
If you are using a single layer only, could you please send us a minimal Unity project that still shows the problem as a zip package, to contact@esotericsoftware.com. Then we can have a look at it.
Just tried with the latest "spine-unity-3.8-2020-09-30.unitypackage" and the problem persists, latest version of Unity 2020, and latest version of the official Spine editor.
I'm using two layers, one "base layer" and one "top layer" ( for the arm/upper body, for shooting). Top Layer blending mode is set to override. The "weight" is turned to zero when the top layer is not in use, and to 1 when shooting etc.
Update: I emailed you a minimal Unity project
Thanks for sending the reproduction package.
The problem is that SkeletonMecanim
requires a key at timelines that shall smoothly be mixed out, the Auto Reset
parameter will otherwise mix out sharply at the end of the animation transition. This is one of the drawbacks of SkeletonMecanim
compared to SkeletonAnimation
.
So in your case, the idle
animation needs to have keys at the first frame that shall be mixed out from the prone
animation. In this case it's leg-left-IK-target
and right-left-IK-target
(and some other bones) rotation and translation keys that are missing. Always mix
mixes the setup pose into the transition, which in your case is similar to the idle pose, thus produces a nice result (this is not always desirable however, it may lead to dipping effects).
BTW: Please be sure to disable Animation cleanup
upon json
export, otherwise keys identical to setup pose will not be exported!
Thank you, that explains a lot. Is there an easy way to figure out what keyframes the animations need to have at the first frame, or do I have to check what animations blend and then add all keyframes (so they match)?
It would be helpful with a feature like "Add first keyframe for all bones transform/rotation" or something like that. But could also be very messy...
PeterBacall wroteIs there an easy way to figure out what keyframes the animations need to have at the first frame, or do I have to check what animations blend and then add all keyframes (so they match)?
Do you mean in the Spine Editor? There you can activate the target animation (while in Animation view) and then hit e.g. Space
to deselect everything. Then you can see all keyed items in the dopesheet. Unfortunately that is still a manual process, as it is performance-wise less optimal to simply select everything and add a keyframe on frame one. However, I'm just a mere programmer, so perhaps someone knows of better ways to accomplish this?
PeterBacall wroteIt would be helpful with a feature like "Add first keyframe for all bones transform/rotation" or something like that. But could also be very messy...
You could do that by either hitting CTRL-A
and/or by SHIFT-LMB
selecting all bones and constraints in the Hierarchy panel. If I misunderstood you there, please let me know.
Admittedly, the situation for SkeletonMecanim
is not without drawbacks compared to SkeletonAnimation
. While you could change the mix mode to AlwaysMix
on the first layer, it would then in some cases cause the mentioned dipping effect (and thus a different undesired transition which you then cannot get rid of). Perhaps we will find a way in the future to prevent the above drawback and get rid of the requirement for additional keys, nevertheless it would then be a major rewrite of the SkeletonMecanim
component and reserved to a later revision change.