Hey dudes, I have a problem. There are two different skeletons. I have used SkeletonAnimationMulti component in my character. When playing animations, for one of my skeletons, I see glitch in animations. When pressing reload button (skeleton asset) in the inspector (editor), it is solved. How can I resolve it?
I use the final release version 4.1.
Thanks.
Glitch problem when using skeleton animation multi
@luciddream I'm afraid we need more context info to be able to help. Please describe in as much detail what code you use that leads to the problem, what the glitch is you see, etc. If possible, please include screenshots.
The animation is a locomotion animation, it blends between idle, move and run animations.
The problem is in back_skeleton while it is OK in front_skeleton.
public void Initialize(AnimationDefinition[] animations)
{
_animations = animations;
_tracks = new TrackEntry[animations.Length];
for (var i = 0; i < _tracks.Length; i++)
{
var animationDefinition = _animations[i];
foreach (var animationStateTrack in _skeletonAnimations.CurrentSkeletonAnimation.AnimationState.Tracks)
{
if (animationStateTrack != null)
{
animationStateTrack.Alpha = 0;
}
}
_tracks[i] = _skeletonAnimations.SetAnimation
(
animationDefinition.TrackIndex,
animationDefinition.Name,
animationDefinition.IsLoop
);
_tracks[i].MixBlend = MixBlend.Add;
}
}
public void UpdateBlendValue(float value)
{
var n = _animations.Length - 1;
var sum = 0f;
for (var i = 0; i <= n; i++)
{
var t = (float)i / n;
var alpha = Mathf.Clamp01(1 - Mathf.Abs(value - t) * n);
_tracks[i].Alpha = alpha;
sum += alpha;
}
for (var i = 0; i < _tracks.Length; i++)
{
_tracks[i].Alpha = Mathf.Clamp01(_tracks[i].Alpha / sum);
}
_skeletonAnimations.CurrentSkeletonAnimation.skeleton.SetBonesToSetupPose();
}
After pressing Reload button just once, the glitch is resolved completely.
@luciddream Thanks for the additional info. Could you please send us a minimal Unity project which still demonstrates your issue? You can send it as a zip package to contact@esotericsoftware.com, briefly mentioning this forum thread URL so that we know the context. Then we can have a look at what's going wrong.