From 447e4d9735adb36bf1553afbce088a382efc2c8b Mon Sep 17 00:00:00 2001 From: RoYan Date: Fri, 24 Dec 2021 14:05:53 +0800 Subject: [PATCH] gltf no animations --- src/models/FBX.ts | 1 + src/models/GLTF.ts | 3 ++- src/models/Model.ts | 1 - 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/models/FBX.ts b/src/models/FBX.ts index 2886940..74f55b8 100644 --- a/src/models/FBX.ts +++ b/src/models/FBX.ts @@ -9,6 +9,7 @@ export default defineComponent({ this.$emit('before-load', loader) loader.load(this.src, (fbx) => { this.onLoad(fbx) + this.initObject3D(fbx) }, this.onProgress, this.onError) }, }) diff --git a/src/models/GLTF.ts b/src/models/GLTF.ts index dde37cc..3bca863 100644 --- a/src/models/GLTF.ts +++ b/src/models/GLTF.ts @@ -8,7 +8,8 @@ export default defineComponent({ const loader = new GLTFLoader() this.$emit('before-load', loader) loader.load(this.src, (gltf) => { - this.onLoad(gltf.scene) + this.onLoad(gltf) + this.initObject3D(gltf.scene) }, this.onProgress, this.onError) }, }) diff --git a/src/models/Model.ts b/src/models/Model.ts index 86a6962..3bc5076 100644 --- a/src/models/Model.ts +++ b/src/models/Model.ts @@ -16,7 +16,6 @@ export default defineComponent({ methods: { onLoad(model: TObject3D) { this.$emit('load', model) - this.initObject3D(model) }, onProgress(progress: ProgressEvent) { this.progress = progress.loaded / progress.total