From 7af1b4b3c53bb495c7ef642b02afbf6b37cdd4ad Mon Sep 17 00:00:00 2001 From: zhakesi Date: Tue, 21 Feb 2023 15:34:08 +0800 Subject: [PATCH] fix switch clip cause baked animation frame index to -1 (#14322) --- cocos/3d/skeletal-animation/skeletal-animation-utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cocos/3d/skeletal-animation/skeletal-animation-utils.ts b/cocos/3d/skeletal-animation/skeletal-animation-utils.ts index f3600c9ec5..c61fb079c8 100644 --- a/cocos/3d/skeletal-animation/skeletal-animation-utils.ts +++ b/cocos/3d/skeletal-animation/skeletal-animation-utils.ts @@ -487,8 +487,9 @@ export class JointAnimationInfo { public switchClip (info: IAnimInfo, clip: AnimationClip | null) { info.currentClip = clip; - info.data[0] = -1; + info.data[0] = 0; // reset default frame 0 info.buffer.update(info.data); + info.data[0] = -1; // reset frame index to -1. sampleCurves will calculate frame to 0. info.dirty = false; if (JSB) { info.dirtyForJSB[0] = 0;