注意在帧数切割时,某段动画帧数是开区间,若0-15 则在切割时最好是到0-16
generateFBX(v, maxTime, startTime) {
var loader = new FBXLoader()
loader.load('FBX/tt1.FBX', (mesh) => {
mesh.scale.set(20, 20, 20)
mesh.position.set(0, 300, 0)
this.mixer = new THREE.AnimationMixer(mesh)
var modelaction = mesh.animations[0]
this.action = this.mixer.clipAction(modelaction)
if (this.actionList.length == 0) {
this.actionList.actionA = this.mixer.clipAction(
THREE.AnimationUtils.subclip(modelaction, 'A', 0, 16)
)
this.actionList.actionA.repetitions = 1
this.actionList.actionA.clampWhenFinished = true
this.actionList.actionB = this.mixer.clipAction(
THREE.AnimationUtils.subclip(modelaction, 'B', 15, 31)
)
this.actionList.actionB.repetitions = 1
this.actionList.actionB.clampWhenFinished = true
}
// 默认1,0 暂停,负值 倒着播放
this.action.timeScale = v
// 设置开始播放的时间,从0开始
this.action.time = startTime
// this.action.play()
// console.log('1', this.action)
// console.log('2', this.actionList.actionA)
this.scene.add(mesh)
})
},
需要哪段动画播放直接调用this.actionList.actionXX.play()
暂停this.actionList.actionXX.pauesd=true