fix: Live2D Ticker registration + outfit texture swap path

- Registered pixi Ticker via (Live2DModel as any).registerTicker()
  to fix 'No Ticker registered' warning and animation issues
- Fixed outfit texture swap: textures live on model.textures[]
  not model.internalModel.textures[]
This commit is contained in:
2026-06-04 12:10:20 -04:00
parent 3d3df64d7c
commit 895fb9ac0b
+7 -3
View File
@@ -48,9 +48,13 @@ export default function KiraAvatar(props: Props) {
} }
await loadScript('/live2d/cubism/live2dcubismcore.min.js'); await loadScript('/live2d/cubism/live2dcubismcore.min.js');
const { Application } = await import('pixi.js'); const { Application, Ticker } = await import('pixi.js');
const { Live2DModel } = await import('pixi-live2d-display/cubism4'); const { Live2DModel } = await import('pixi-live2d-display/cubism4');
// Register pixi Ticker so Live2DModel can drive animations
// Cast needed due to pixi-live2d-display expecting older Ticker type
(Live2DModel as any).registerTicker(Ticker as any);
// Responsive sizing // Responsive sizing
const size = Math.min(container.clientWidth || 260, 260); const size = Math.min(container.clientWidth || 260, 260);
const app = new Application({ const app = new Application({
@@ -173,8 +177,8 @@ export default function KiraAvatar(props: Props) {
const tex = await Assets.load(outfitUrl); const tex = await Assets.load(outfitUrl);
// Swap texture slot 2 (clothing layer) in the model's texture array. // Swap texture slot 2 (clothing layer) in the model's texture array.
// The render loop automatically binds WebGL textures from PixiJS textures. // The render loop automatically binds WebGL textures from PixiJS textures.
if ((model as any).internalModel?.textures) { if ((model as any).textures) {
(model as any).internalModel.textures[2] = tex; (model as any).textures[2] = tex;
} else { } else {
console.warn('[Outfit] cannot swap — no textures array'); console.warn('[Outfit] cannot swap — no textures array');
} }