sa2kit 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mmd/index.js CHANGED
@@ -516,7 +516,6 @@ var MMDPlayerEnhanced = ({
516
516
  };
517
517
  }, [stage]);
518
518
  const clearOldResources = () => {
519
- console.log("\u{1F9F9} [MMDPlayerEnhanced] \u5F00\u59CB\u6E05\u9664\u65E7\u8D44\u6E90\uFF08\u589E\u5F3A\u6E05\u7406\uFF09");
520
519
  if (!sceneRef.current) return;
521
520
  if (isPlayingRef.current) {
522
521
  isPlayingRef.current = false;
@@ -526,27 +525,64 @@ var MMDPlayerEnhanced = ({
526
525
  audioRef.current.pause();
527
526
  audioRef.current.currentTime = 0;
528
527
  audioRef.current.onended = null;
528
+ audioRef.current.src = "";
529
+ audioRef.current.load();
529
530
  audioRef.current = null;
530
531
  }
531
532
  if (helperRef.current) {
532
533
  try {
534
+ helperRef.current.enable("animation", false);
535
+ helperRef.current.enable("ik", false);
536
+ helperRef.current.enable("grant", false);
537
+ helperRef.current.enable("physics", false);
533
538
  const helperObjects = helperRef.current.objects;
534
539
  if (helperObjects && Array.isArray(helperObjects)) {
535
- console.log(`\u{1F9F9} \u6E05\u9664 helper \u4E2D\u7684 ${helperObjects.length} \u4E2A\u5BF9\u8C61`);
540
+ helperObjects.forEach((obj) => {
541
+ if (obj.physics) {
542
+ try {
543
+ const physics = obj.physics;
544
+ if (physics.bodies && Array.isArray(physics.bodies)) {
545
+ physics.bodies.forEach((body) => {
546
+ if (physics.world && body) {
547
+ physics.world.removeRigidBody(body);
548
+ }
549
+ });
550
+ physics.bodies.length = 0;
551
+ }
552
+ if (physics.constraints && Array.isArray(physics.constraints)) {
553
+ physics.constraints.forEach((constraint) => {
554
+ if (physics.world && constraint) {
555
+ physics.world.removeConstraint(constraint);
556
+ }
557
+ });
558
+ physics.constraints.length = 0;
559
+ }
560
+ if (physics.world) {
561
+ const world = physics.world;
562
+ while (world.getNumCollisionObjects() > 0) {
563
+ const body = world.getCollisionObjectArray().at(0);
564
+ world.removeCollisionObject(body);
565
+ }
566
+ }
567
+ if (physics.reset) physics.reset();
568
+ obj.physics = null;
569
+ } catch (e) {
570
+ console.warn("\u6E05\u7406\u7269\u7406\u7CFB\u7EDF\u5931\u8D25:", e);
571
+ }
572
+ }
573
+ });
536
574
  helperObjects.length = 0;
537
575
  }
538
576
  } catch (error2) {
539
- console.warn("\u26A0\uFE0F \u65E0\u6CD5\u8BBF\u95EE helper.objects\uFF0C\u521B\u5EFA\u65B0\u7684 helper:", error2);
577
+ console.warn("\u6E05\u7406 helper \u5931\u8D25:", error2);
540
578
  }
541
579
  helperRef.current = null;
542
580
  }
543
581
  if (sceneRef.current.background && sceneRef.current.background.isTexture) {
544
- console.log("\u{1F9F9} \u6E05\u9664\u573A\u666F\u80CC\u666F\u8D34\u56FE");
545
582
  sceneRef.current.background.dispose();
546
583
  sceneRef.current.background = null;
547
584
  }
548
585
  if (sceneRef.current.environment && sceneRef.current.environment.isTexture) {
549
- console.log("\u{1F9F9} \u6E05\u9664\u573A\u666F\u73AF\u5883\u8D34\u56FE");
550
586
  sceneRef.current.environment.dispose();
551
587
  sceneRef.current.environment = null;
552
588
  }
@@ -560,26 +596,28 @@ var MMDPlayerEnhanced = ({
560
596
  }
561
597
  });
562
598
  objectsToRemove.forEach((obj) => {
563
- if (obj.parent) {
564
- obj.parent.remove(obj);
565
- }
599
+ if (obj.parent) obj.parent.remove(obj);
566
600
  if (obj.geometry) {
567
601
  obj.geometry.dispose();
568
602
  }
569
603
  if (obj.material) {
570
- const material = obj.material;
571
604
  const disposeMaterial = (m) => {
572
- if (m.map) m.map.dispose();
573
- if (m.emissiveMap) m.emissiveMap.dispose();
574
- if (m.normalMap) m.normalMap.dispose();
575
- if (m.bumpMap) m.bumpMap.dispose();
576
- if (m.specularMap) m.specularMap.dispose();
577
- if (m.envMap) m.envMap.dispose();
578
- if (m.lightMap) m.lightMap.dispose();
579
- if (m.aoMap) m.aoMap.dispose();
580
- if (m.alphaMap) m.alphaMap.dispose();
605
+ [
606
+ "map",
607
+ "emissiveMap",
608
+ "normalMap",
609
+ "bumpMap",
610
+ "specularMap",
611
+ "envMap",
612
+ "lightMap",
613
+ "aoMap",
614
+ "alphaMap"
615
+ ].forEach((prop) => {
616
+ if (m[prop]) m[prop].dispose();
617
+ });
581
618
  m.dispose();
582
619
  };
620
+ const material = obj.material;
583
621
  if (Array.isArray(material)) {
584
622
  material.forEach(disposeMaterial);
585
623
  } else {
@@ -587,29 +625,23 @@ var MMDPlayerEnhanced = ({
587
625
  }
588
626
  }
589
627
  if (obj.skeleton) {
590
- console.log("\u{1F9F9} \u6E05\u7406\u9AA8\u9ABC\u6570\u636E");
591
628
  obj.skeleton = null;
592
629
  }
593
630
  });
594
631
  clockRef.current = new THREE2__namespace.Clock();
595
632
  vmdDataRef.current = null;
596
633
  setNeedReset(false);
597
- console.log(`\u2705 [MMDPlayerEnhanced] \u5DF2\u6E05\u9664 ${objectsToRemove.length} \u4E2A\u5BF9\u8C61\uFF08\u589E\u5F3A\u6E05\u7406\u5B8C\u6210\uFF09`);
634
+ if (window.gc) {
635
+ try {
636
+ window.gc();
637
+ } catch (e) {
638
+ }
639
+ }
640
+ console.log(`\u2705 \u8D44\u6E90\u6E05\u7406\u5B8C\u6210 (${objectsToRemove.length} \u4E2A\u5BF9\u8C61)`);
598
641
  };
599
642
  React2.useEffect(() => {
600
- console.log("\u{1F4E6} [MMDPlayerEnhanced] \u8D44\u6E90\u52A0\u8F7D useEffect \u89E6\u53D1");
601
- console.log("\u{1F50D} [MMDPlayerEnhanced] sceneRef.current:", sceneRef.current);
602
- console.log("\u{1F50D} [MMDPlayerEnhanced] cameraRef.current:", cameraRef.current);
603
- console.log("\u{1F50D} [MMDPlayerEnhanced] isLoadedRef.current:", isLoadedRef.current);
604
- if (!sceneRef.current || !cameraRef.current) {
605
- console.warn("\u26A0\uFE0F [MMDPlayerEnhanced] \u573A\u666F\u6216\u76F8\u673A\u672A\u521D\u59CB\u5316\uFF0C\u8DF3\u8FC7\u8D44\u6E90\u52A0\u8F7D");
606
- return;
607
- }
608
- if (isLoadedRef.current) {
609
- console.log("\u26A0\uFE0F [MMDPlayerEnhanced] \u8D44\u6E90\u5DF2\u52A0\u8F7D\uFF0C\u8DF3\u8FC7\u91CD\u590D\u52A0\u8F7D");
610
- return;
611
- }
612
- console.log("\u2705 [MMDPlayerEnhanced] \u573A\u666F\u548C\u76F8\u673A\u5DF2\u5C31\u7EEA\uFF0C\u5F00\u59CB\u52A0\u8F7D\u8D44\u6E90");
643
+ if (!sceneRef.current || !cameraRef.current) return;
644
+ if (isLoadedRef.current) return;
613
645
  clearOldResources();
614
646
  isLoadedRef.current = true;
615
647
  const loadMMD = async () => {
@@ -622,63 +654,39 @@ var MMDPlayerEnhanced = ({
622
654
  lastAnimationTimeRef.current = 0;
623
655
  animationStoppedCountRef.current = 0;
624
656
  if (stage?.enablePhysics !== false) {
625
- const ammoScriptPath = stage?.ammoPath || "/mikutalking/libs/ammo.wasm.js";
626
- const ammoWasmPath = stage?.ammoWasmPath || "/mikutalking/libs/";
627
- console.log("\u{1F527} [MMDPlayerEnhanced] \u68C0\u6D4B\u5230\u542F\u7528\u7269\u7406\uFF0C\u5F00\u59CB\u52A0\u8F7D Ammo.js");
628
- console.log("\u{1F4C2} [MMDPlayerEnhanced] Ammo \u811A\u672C\u8DEF\u5F84:", ammoScriptPath);
629
- console.log("\u{1F4C2} [MMDPlayerEnhanced] Ammo WASM \u8DEF\u5F84:", ammoWasmPath);
630
657
  setLoadingProgress(5);
631
658
  await loadAmmo({
632
- scriptPath: ammoScriptPath,
633
- wasmBasePath: ammoWasmPath
659
+ scriptPath: stage?.ammoPath || "/mikutalking/libs/ammo.wasm.js",
660
+ wasmBasePath: stage?.ammoWasmPath || "/mikutalking/libs/"
634
661
  });
635
- console.log("\u2705 [MMDPlayerEnhanced] Ammo.js \u52A0\u8F7D\u5B8C\u6210");
636
662
  }
637
663
  const manager = new THREE2__namespace.LoadingManager();
638
- const modelUrl = currentResources.modelPath;
639
- const basePath = modelUrl.substring(0, modelUrl.lastIndexOf("/") + 1);
640
- console.log("\u{1F4C2} [MMDPlayerEnhanced] \u6A21\u578B\u57FA\u7840\u8DEF\u5F84:", basePath);
664
+ const basePath = currentResources.modelPath.substring(0, currentResources.modelPath.lastIndexOf("/") + 1);
641
665
  manager.setURLModifier((url) => {
642
- if (url.startsWith("http://") || url.startsWith("https://")) {
643
- console.log("\u{1F517} [MMDPlayerEnhanced] \u4F7F\u7528\u5B8C\u6574 URL:", url);
644
- return url;
645
- }
646
- if (url.startsWith("/")) {
647
- console.log("\u{1F517} [MMDPlayerEnhanced] \u4F7F\u7528\u7EDD\u5BF9\u8DEF\u5F84:", url);
648
- return url;
649
- }
650
- const fullUrl = basePath + url;
651
- console.log("\u{1F517} [MMDPlayerEnhanced] \u76F8\u5BF9\u8DEF\u5F84\u8F6C\u6362:", url, "->", fullUrl);
652
- return fullUrl;
666
+ if (url.startsWith("http://") || url.startsWith("https://")) return url;
667
+ if (url.startsWith("/")) return url;
668
+ return basePath + url;
653
669
  });
654
670
  const loader = new threeStdlib.MMDLoader(manager);
655
671
  const helper = new threeStdlib.MMDAnimationHelper();
656
672
  helperRef.current = helper;
657
673
  setLoadingProgress(20);
658
674
  const modelStartTime = performance.now();
659
- console.log("\u{1F3AD} \u5F00\u59CB\u52A0\u8F7D\u6A21\u578B:", currentResources.modelPath);
660
- console.log("\u{1F4CA} [\u6027\u80FD] \u6A21\u578B\u52A0\u8F7D\u5F00\u59CB\u65F6\u95F4:", (/* @__PURE__ */ new Date()).toISOString());
661
675
  const mesh = await new Promise((resolve, reject) => {
662
676
  loader.load(
663
677
  currentResources.modelPath,
664
678
  (object) => {
665
- const modelEndTime = performance.now();
666
- const modelLoadTime = ((modelEndTime - modelStartTime) / 1e3).toFixed(2);
667
- console.log(`\u2705 \u6A21\u578B\u52A0\u8F7D\u6210\u529F (\u8017\u65F6: ${modelLoadTime}\u79D2)`);
668
- console.log(`\u{1F4CA} [\u6027\u80FD] \u6A21\u578B\u5927\u5C0F: ${object.geometry ? (object.geometry.attributes.position.count * 3 * 4 / 1024 / 1024).toFixed(2) : "N/A"} MB`);
679
+ const loadTime = ((performance.now() - modelStartTime) / 1e3).toFixed(2);
680
+ console.log(`\u2705 \u6A21\u578B\u52A0\u8F7D\u5B8C\u6210 (${loadTime}s)`);
669
681
  resolve(object);
670
682
  },
671
683
  (progress) => {
672
684
  if (progress.total > 0) {
673
- const percent = progress.loaded / progress.total * 30 + 20;
674
- setLoadingProgress(Math.min(percent, 50));
675
- console.log(`\u{1F4E5} \u6A21\u578B\u52A0\u8F7D\u8FDB\u5EA6: ${(progress.loaded / progress.total * 100).toFixed(1)}% (${(progress.loaded / 1024 / 1024).toFixed(2)}MB / ${(progress.total / 1024 / 1024).toFixed(2)}MB)`);
685
+ setLoadingProgress(Math.min(progress.loaded / progress.total * 30 + 20, 50));
676
686
  }
677
687
  },
678
688
  (error2) => {
679
- const modelEndTime = performance.now();
680
- const modelLoadTime = ((modelEndTime - modelStartTime) / 1e3).toFixed(2);
681
- console.error(`\u274C \u6A21\u578B\u52A0\u8F7D\u5931\u8D25 (\u8017\u65F6: ${modelLoadTime}\u79D2):`, error2);
689
+ console.error("\u274C \u6A21\u578B\u52A0\u8F7D\u5931\u8D25:", error2);
682
690
  reject(error2);
683
691
  }
684
692
  );
@@ -688,52 +696,21 @@ var MMDPlayerEnhanced = ({
688
696
  }
689
697
  sceneRef.current.add(mesh);
690
698
  if (currentResources.stageModelPath) {
691
- console.log("\u{1F3F0} \u5F00\u59CB\u52A0\u8F7D\u573A\u666F\u6A21\u578B:", currentResources.stageModelPath);
692
699
  const stageMesh = await new Promise((resolve, reject) => {
693
- loader.load(
694
- currentResources.stageModelPath,
695
- (object) => {
696
- console.log("\u2705 \u573A\u666F\u6A21\u578B\u52A0\u8F7D\u6210\u529F");
697
- resolve(object);
698
- },
699
- void 0,
700
- (error2) => {
701
- console.error("\u274C \u573A\u666F\u6A21\u578B\u52A0\u8F7D\u5931\u8D25:", error2);
702
- reject(error2);
703
- }
704
- );
700
+ loader.load(currentResources.stageModelPath, resolve, void 0, reject);
705
701
  });
706
702
  sceneRef.current.add(stageMesh);
707
703
  }
708
704
  if (currentResources.backgroundPath && sceneRef.current) {
709
- const bgStartTime = performance.now();
710
- console.log("\u{1F5BC}\uFE0F \u5F00\u59CB\u52A0\u8F7D\u80CC\u666F\u56FE\u7247:", currentResources.backgroundPath);
711
705
  const textureLoader = new THREE2__namespace.TextureLoader();
712
706
  const backgroundTexture = await new Promise((resolve, reject) => {
713
- textureLoader.load(
714
- currentResources.backgroundPath,
715
- (texture) => {
716
- const bgEndTime = performance.now();
717
- const bgLoadTime = ((bgEndTime - bgStartTime) / 1e3).toFixed(2);
718
- console.log(`\u2705 \u80CC\u666F\u56FE\u7247\u52A0\u8F7D\u6210\u529F (\u8017\u65F6: ${bgLoadTime}\u79D2, \u5C3A\u5BF8: ${texture.image.width}x${texture.image.height})`);
719
- resolve(texture);
720
- },
721
- void 0,
722
- (err) => {
723
- const bgEndTime = performance.now();
724
- const bgLoadTime = ((bgEndTime - bgStartTime) / 1e3).toFixed(2);
725
- console.error(`\u274C \u80CC\u666F\u56FE\u7247\u52A0\u8F7D\u5931\u8D25 (\u8017\u65F6: ${bgLoadTime}\u79D2):`, err);
726
- reject(err);
727
- }
728
- );
707
+ textureLoader.load(currentResources.backgroundPath, resolve, void 0, reject);
729
708
  });
730
709
  backgroundTexture.colorSpace = THREE2__namespace.SRGBColorSpace;
731
710
  if (stage?.backgroundType === "skybox") {
732
711
  backgroundTexture.mapping = THREE2__namespace.EquirectangularReflectionMapping;
733
712
  sceneRef.current.background = backgroundTexture;
734
713
  sceneRef.current.environment = backgroundTexture;
735
- } else if (stage?.backgroundType === "image") {
736
- sceneRef.current.background = backgroundTexture;
737
714
  } else {
738
715
  sceneRef.current.background = backgroundTexture;
739
716
  }
@@ -742,31 +719,17 @@ var MMDPlayerEnhanced = ({
742
719
  let cameraVmd = null;
743
720
  if (currentResources.motionPath) {
744
721
  setLoadingProgress(60);
745
- const motionStartTime = performance.now();
746
- console.log("\u{1F483} \u5F00\u59CB\u52A0\u8F7D\u52A8\u4F5C:", currentResources.motionPath);
747
722
  vmd = await new Promise((resolve, reject) => {
748
723
  loader.loadAnimation(
749
724
  currentResources.motionPath,
750
725
  mesh,
751
- (vmdObject) => {
752
- const motionEndTime = performance.now();
753
- const motionLoadTime = ((motionEndTime - motionStartTime) / 1e3).toFixed(2);
754
- console.log(`\u2705 \u52A8\u4F5C\u52A0\u8F7D\u6210\u529F (\u8017\u65F6: ${motionLoadTime}\u79D2)`);
755
- resolve(vmdObject);
756
- },
726
+ resolve,
757
727
  (progress) => {
758
728
  if (progress.total > 0) {
759
- const percent = progress.loaded / progress.total * 20 + 60;
760
- setLoadingProgress(Math.min(percent, 80));
761
- console.log(`\u{1F4E5} \u52A8\u4F5C\u52A0\u8F7D\u8FDB\u5EA6: ${(progress.loaded / progress.total * 100).toFixed(1)}%`);
729
+ setLoadingProgress(Math.min(progress.loaded / progress.total * 20 + 60, 80));
762
730
  }
763
731
  },
764
- (error2) => {
765
- const motionEndTime = performance.now();
766
- const motionLoadTime = ((motionEndTime - motionStartTime) / 1e3).toFixed(2);
767
- console.error(`\u274C \u52A8\u4F5C\u52A0\u8F7D\u5931\u8D25 (\u8017\u65F6: ${motionLoadTime}\u79D2):`, error2);
768
- reject(error2);
769
- }
732
+ reject
770
733
  );
771
734
  });
772
735
  helper.add(mesh, {
@@ -784,10 +747,6 @@ var MMDPlayerEnhanced = ({
784
747
  }
785
748
  if (maxDuration > 0) {
786
749
  animationDurationRef.current = maxDuration;
787
- console.log("\u23F1\uFE0F \u52A8\u753B\u65F6\u957F:", maxDuration, "\u79D2");
788
- } else {
789
- console.warn("\u26A0\uFE0F \u65E0\u6CD5\u83B7\u53D6\u52A8\u753B\u65F6\u957F\uFF0C\u5C06\u65E0\u6CD5\u81EA\u52A8\u68C0\u6D4B\u52A8\u753B\u7ED3\u675F");
790
- console.log("\u{1F4CB} VMD \u6570\u636E\u7ED3\u6784:", vmd);
791
750
  }
792
751
  }
793
752
  } else {
@@ -795,38 +754,18 @@ var MMDPlayerEnhanced = ({
795
754
  }
796
755
  if (currentResources.cameraPath && cameraRef.current) {
797
756
  setLoadingProgress(80);
798
- console.log("\u{1F4F7} \u5F00\u59CB\u52A0\u8F7D\u955C\u5934:", currentResources.cameraPath);
799
757
  cameraVmd = await new Promise((resolve, reject) => {
800
- loader.loadAnimation(
801
- currentResources.cameraPath,
802
- cameraRef.current,
803
- (vmdObject) => {
804
- console.log("\u2705 \u955C\u5934\u52A0\u8F7D\u6210\u529F");
805
- resolve(vmdObject);
806
- },
807
- void 0,
808
- (error2) => {
809
- console.error("\u274C \u955C\u5934\u52A0\u8F7D\u5931\u8D25:", error2);
810
- reject(error2);
811
- }
812
- );
758
+ loader.loadAnimation(currentResources.cameraPath, cameraRef.current, resolve, void 0, reject);
813
759
  });
814
760
  helper.add(cameraRef.current, { animation: cameraVmd });
815
761
  }
816
762
  if (currentResources.audioPath) {
817
763
  setLoadingProgress(90);
818
- const audioStartTime = performance.now();
819
- console.log("\u{1F3B5} \u5F00\u59CB\u52A0\u8F7D\u97F3\u9891:", currentResources.audioPath);
820
764
  const audio = new Audio(currentResources.audioPath);
821
765
  audio.volume = 0.5;
822
766
  audio.loop = loop;
823
767
  audioRef.current = audio;
824
768
  hasAudioRef.current = true;
825
- audio.onloadedmetadata = () => {
826
- const audioEndTime = performance.now();
827
- const audioLoadTime = ((audioEndTime - audioStartTime) / 1e3).toFixed(2);
828
- console.log(`\u2705 \u97F3\u9891\u52A0\u8F7D\u6210\u529F (\u8017\u65F6: ${audioLoadTime}\u79D2, \u65F6\u957F: ${audio.duration.toFixed(2)}\u79D2)`);
829
- };
830
769
  audio.onended = () => {
831
770
  if (!loop) {
832
771
  setIsPlaying(false);
@@ -844,12 +783,7 @@ var MMDPlayerEnhanced = ({
844
783
  }
845
784
  setLoadingProgress(100);
846
785
  setLoading(false);
847
- vmdDataRef.current = {
848
- mesh,
849
- vmd,
850
- cameraVmd
851
- };
852
- console.log("\u{1F389} \u6240\u6709\u8D44\u6E90\u52A0\u8F7D\u5B8C\u6210\uFF01");
786
+ vmdDataRef.current = { mesh, vmd, cameraVmd };
853
787
  if (shouldAutoPlayAfterReloadRef.current) {
854
788
  shouldAutoPlayAfterReloadRef.current = false;
855
789
  setTimeout(() => play(), 500);
@@ -868,64 +802,49 @@ var MMDPlayerEnhanced = ({
868
802
  loadMMD();
869
803
  }, [currentResources, stage?.enablePhysics, autoPlay, loop, onLoad, onError, reloadTrigger]);
870
804
  const play = () => {
871
- console.log("\u{1F3AC} [play] \u51FD\u6570\u88AB\u8C03\u7528\uFF0CneedReset =", needReset);
872
805
  if (!helperRef.current && !needReset) return;
873
806
  if (needReset && vmdDataRef.current && sceneRef.current && cameraRef.current) {
874
- console.log("\u{1F504} \u68C0\u6D4B\u5230\u9700\u8981\u91CD\u7F6E\uFF0C\u91CD\u65B0\u521D\u59CB\u5316 helper\uFF08\u4FDD\u7559\u6A21\u578B\uFF09");
875
807
  const { mesh, vmd, cameraVmd } = vmdDataRef.current;
876
808
  if (helperRef.current) {
877
809
  try {
878
810
  const helperObjects = helperRef.current.objects;
879
811
  if (helperObjects && Array.isArray(helperObjects)) {
880
812
  helperObjects.length = 0;
881
- console.log("\u{1F9F9} \u6E05\u7A7A\u4E86\u65E7 helper \u7684 objects \u6570\u7EC4");
882
813
  }
883
814
  } catch (error2) {
884
- console.warn("\u26A0\uFE0F \u65E0\u6CD5\u6E05\u7A7A\u65E7 helper.objects:", error2);
885
815
  }
886
816
  }
887
817
  const newHelper = new threeStdlib.MMDAnimationHelper();
888
818
  helperRef.current = newHelper;
889
819
  clockRef.current = new THREE2__namespace.Clock();
890
820
  if (vmd && typeof vmd === "object") {
891
- console.log("\u{1F4E6} \u91CD\u65B0\u6DFB\u52A0\u6A21\u578B\u52A8\u753B");
892
821
  try {
893
822
  newHelper.add(mesh, {
894
823
  animation: vmd,
895
824
  physics: stage?.enablePhysics !== false
896
825
  });
897
- console.log("\u2705 \u6A21\u578B\u52A8\u753B\u6DFB\u52A0\u6210\u529F");
898
826
  } catch (error2) {
899
- console.error("\u274C \u91CD\u65B0\u6DFB\u52A0\u6A21\u578B\u52A8\u753B\u5931\u8D25:", error2);
900
827
  try {
901
828
  newHelper.add(mesh, { physics: stage?.enablePhysics !== false });
902
- console.log("\u2705 \u4EC5\u6DFB\u52A0\u6A21\u578B\u548C\u7269\u7406\uFF08\u65E0\u52A8\u753B\uFF09");
903
829
  } catch (innerError) {
904
- console.error("\u274C \u6DFB\u52A0\u6A21\u578B\u4E5F\u5931\u8D25\u4E86:", innerError);
905
830
  }
906
831
  }
907
832
  } else {
908
833
  try {
909
834
  newHelper.add(mesh, { physics: stage?.enablePhysics !== false });
910
- console.log("\u2705 \u4EC5\u6DFB\u52A0\u6A21\u578B\u548C\u7269\u7406\uFF08\u65E0\u52A8\u753B\u6570\u636E\uFF09");
911
835
  } catch (error2) {
912
- console.error("\u274C \u6DFB\u52A0\u6A21\u578B\u5931\u8D25:", error2);
913
836
  }
914
837
  }
915
838
  if (cameraVmd && typeof cameraVmd === "object") {
916
- console.log("\u{1F4F7} \u91CD\u65B0\u6DFB\u52A0\u76F8\u673A\u52A8\u753B");
917
839
  try {
918
840
  newHelper.add(cameraRef.current, { animation: cameraVmd });
919
- console.log("\u2705 \u76F8\u673A\u52A8\u753B\u6DFB\u52A0\u6210\u529F");
920
841
  } catch (error2) {
921
- console.error("\u274C \u91CD\u65B0\u6DFB\u52A0\u76F8\u673A\u52A8\u753B\u5931\u8D25:", error2);
922
842
  }
923
843
  }
924
844
  if (audioRef.current) {
925
845
  audioRef.current.currentTime = 0;
926
846
  }
927
847
  setNeedReset(false);
928
- console.log("\u2705 Helper \u91CD\u65B0\u521D\u59CB\u5316\u5B8C\u6210\uFF0C\u51C6\u5907\u4ECE\u7B2C\u4E00\u5E27\u64AD\u653E");
929
848
  }
930
849
  if (!helperRef.current) {
931
850
  console.error("\u274C [play] helper \u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u64AD\u653E");