vue-three 引入fbx模型

.fbx文件需放在public目錄下


image.png
import { FBXLoader } from "three/examples/jsm/loaders/FBXLoader";
mounted(){
    this.mod();
},
methods: {
  mod(){
      let that = this
      let loader = new FBXLoader()
      loader.load('three/SambaDancing.fbx', function(obj){
        obj.scale.set(.35, .35, .35); // 放大縮小
        obj.position.set(205, 0, -80); // 位置
        obj.rotation.y += 1.55; // 旋轉(zhuǎn)
        that.scene.add(obj)

        that.clock = new THREE.Clock()
        // obj作為參數(shù)創(chuàng)建一個(gè)混合器,解析播放obj及其子對(duì)象包含的動(dòng)畫(huà)數(shù)據(jù)
        that.mixer = new THREE.AnimationMixer(obj);
        let animationAction = that.mixer.clipAction(obj.animations[0]);
        // animationAction.timeScale = 1; //默認(rèn)1,可以調(diào)節(jié)播放速度
        // animationAction.loop = THREE.LoopOnce; //不循環(huán)播放
        // animationAction.clampWhenFinished=true;//暫停在最后一幀播放的狀態(tài)
        animationAction.play(); //播放動(dòng)畫(huà)
      }, undefined, function ( error ) {
        console.error( error );
      });
  },
}
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容