From 8f902a43cd8fb6e07605d2db7e35eaaa2f540879 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期一, 06 三月 2023 14:36:02 +0800
Subject: [PATCH] #
---
static/js/object/DefineModel.js | 29 ++++++++++++++++++++++++++++-
1 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/static/js/object/DefineModel.js b/static/js/object/DefineModel.js
index ce4170a..cb46f1b 100644
--- a/static/js/object/DefineModel.js
+++ b/static/js/object/DefineModel.js
@@ -2,11 +2,38 @@
export class DefineModel {
+ object;
+ mixer;
constructor(object) {
- this.object = object;
+ let that = this;
+ that.object = object;
+ that.mixer;
+ const loader = new FBXLoader();
+ // loader.load( '../static/model/fbx/fbxDemo.fbx', function ( object ) {
+ loader.load( '../static/model/fbx/Samba Dancing.fbx', function ( object ) {
+ that.mixer = new THREE.AnimationMixer( object );
+ const action = that.mixer.clipAction( object.animations[ 0 ] );
+ action.play();
+
+ object.traverse( function ( child ) {
+
+ if ( child.isMesh ) {
+
+ child.castShadow = true;
+ child.receiveShadow = true;
+ child.material = new THREE.MeshLambertMaterial({
+ color: 0xCD6839
+ });
+ }
+
+ } );
+
+ that.object.addObject( object );
+
+ } );
}
--
Gitblit v1.9.1