From 0a6946b580222abb49647d0db1d25f34cf61fd68 Mon Sep 17 00:00:00 2001 From: hobokenchicken Date: Thu, 4 Jun 2026 11:57:33 -0400 Subject: [PATCH] fix: pixi v7 isInteractive TypeError + outfit texture swap - Added isInteractive() stub on Live2DModel to prevent 'e.isInteractive is not a function' errors in pixi v7 - Swapped outfit texture loading to use Assets.load() with cascading fallbacks (model.setTexture -> internalModel -> coreModel) - Removed unused Texture import --- frontend/src/components/KiraAvatar.tsx | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/KiraAvatar.tsx b/frontend/src/components/KiraAvatar.tsx index b27b4d1..faf3e41 100644 --- a/frontend/src/components/KiraAvatar.tsx +++ b/frontend/src/components/KiraAvatar.tsx @@ -48,7 +48,7 @@ export default function KiraAvatar(props: Props) { } await loadScript('/live2d/cubism/live2dcubismcore.min.js'); - const { Application, Texture } = await import('pixi.js'); + const { Application } = await import('pixi.js'); const { Live2DModel } = await import('pixi-live2d-display/cubism4'); // Responsive sizing @@ -81,6 +81,9 @@ export default function KiraAvatar(props: Props) { app.stage.addChild(model as any); + // Fix: prevent pixi v7 isInteractive TypeError with Live2D model + (model as any).isInteractive = () => false; + // Store reference to texture_02 for outfit swapping try { textureRef.current = { @@ -166,10 +169,20 @@ export default function KiraAvatar(props: Props) { (async () => { try { - const { Texture, BaseTexture } = await import('pixi.js'); - const base = await BaseTexture.from(outfitUrl); - const tex = new Texture(base); - model.internalModel.coreModel.setTexture(2, base); + const { Assets, Texture } = await import('pixi.js'); + const tex = await Assets.load(outfitUrl); + // Swap texture slot 2 (clothing layer) + if ((model as any).setTexture) { + (model as any).setTexture(2, tex); + } else { + // Fallback: try internal model + try { + (model.internalModel as any).setTexture(2, tex); + } catch { + // Fallback: direct core model + (model.internalModel.coreModel as any).setTexture(2, tex); + } + } } catch (e) { console.warn('[Outfit] texture swap failed:', e); }