Skip to content

Commit

Permalink
fix: 修复 ikHanler 导致的舞蹈动画问题
Browse files Browse the repository at this point in the history
  • Loading branch information
rdmclin2 committed Sep 18, 2024
1 parent 3bb1c67 commit 8e07780
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
17 changes: 8 additions & 9 deletions src/app/chat/ChatInfo/DanceList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ const DanceList = memo((props: PlayListProps) => {
/>
}
/>

<Virtuoso
computeItemKey={(_, item) => item.danceId}
data={danceList}
followOutput={false}
itemContent={(index, item) => <DanceItem danceItem={item} key={item.danceId} />}
/>

{danceList.length === 0 ? (
<Empty description={t('noDanceList')} image={Empty.PRESENTED_IMAGE_SIMPLE}>
<GradientButton
Expand All @@ -85,7 +77,14 @@ const DanceList = memo((props: PlayListProps) => {
{t('danceMarket')}
</GradientButton>
</Empty>
) : null}
) : (
<Virtuoso
computeItemKey={(_, item) => item.danceId}
data={danceList}
followOutput={false}
itemContent={(index, item) => <DanceItem danceItem={item} key={item.danceId} />}
/>
)}
</Flexbox>
</Flexbox>
);
Expand Down
13 changes: 8 additions & 5 deletions src/libs/emoteController/motionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export class MotionManager {
this.vrm = vrm;
this.mixer = new AnimationMixer(vrm.scene);
this.ikHandler = IKHandler.get(vrm);
this.currentAction = undefined;
this.currentClip = undefined;
}

public async loadMotionUrl(
Expand Down Expand Up @@ -70,18 +72,19 @@ export class MotionManager {
}

public disposeCurrentMotion(): void {
if (this.currentClip && this.mixer) {
this.mixer.stopAllAction();
if (this.currentClip) {
this.mixer.uncacheAction(this.currentClip);
this.mixer.uncacheClip(this.currentClip);
this.currentAction = undefined;
}

this.ikHandler.disableAll();

if (this.currentAction) {
this.currentAction.stop();
this.currentClip = undefined;
}
this.ikHandler.disableAll();

this.currentAction = undefined;
this.currentClip = undefined;
}

public update(delta: number): void {
Expand Down
5 changes: 3 additions & 2 deletions src/libs/vrmViewer/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ export class Model {
const { volume } = this._lipSync.update();
this.emoteController?.lipSync('aa', volume);
}

this.emoteController?.update(delta);
// vrm 先更新
this.vrm?.update(delta);
// 后更新表情动作
this.emoteController?.update(delta);
}
}

0 comments on commit 8e07780

Please sign in to comment.