bill 1 年之前
父节点
当前提交
c97050a388
共有 1 个文件被更改,包括 16 次插入8 次删除
  1. 16 8
      src/sdk/association.ts

+ 16 - 8
src/sdk/association.ts

@@ -51,30 +51,37 @@ const associationModels = (sdk: SDK) => {
       })
       sceneModelMap.set(itemRaw, sceneModel)
 
+      let delyLoad = true
+      setTimeout(() => {
+        delyLoad = false
+      }, 3000)
       sceneModel.bus.on('transformChanged', transform => {
         setTimeout(() => {
           selfUpdate = true
           const data = transform;
           if (transform.rotation) {
             data.rotation = {
-              x: round(transform.rotation.x, 3),
-              y: round(transform.rotation.y, 3),
-              z: round(transform.rotation.z, 3)
+              x: round(transform.rotation.x, 5),
+              y: round(transform.rotation.y, 5),
+              z: round(transform.rotation.z, 5)
             }
           }
           if (transform.position) {
             data.position = {
-              x: round(transform.position.x, 3),
-              y: round(transform.position.y, 3),
-              z: round(transform.position.z, 3)
+              x: transform.position.x,
+              y: round(transform.position.y, 5),
+              z: round(transform.position.z, 5)
             }
           }
           if (transform.bottom) {
-            data.bottom = round(transform.bottom)
+            data.bottom = round(transform.bottom,5)
           }
           if (transform.scale) {
-            data.scale = round(transform.scale)
+            data.scale = round(transform.scale,5)
           }
+          console.log(delyLoad,{...item}, data)
+
+          Object.assign(delyLoad ? toRaw(item) : item, data)
           nextTick(() => selfUpdate = false)
         })
       })
@@ -122,6 +129,7 @@ const associationModels = (sdk: SDK) => {
           }, {flush: 'sync'})
           watchEffect(() => {
             item.position
+            selfUpdate || console.log('change position')
             selfUpdate || getSceneModel(item)?.changePosition(item.position)
           }, {flush: 'sync'})
           watchEffect(() => {