From 1f7585d8c4cc86f0a1e6d3d62188e88698b57089 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期三, 15 十二月 2021 16:14:36 +0800
Subject: [PATCH] #

---
 static/js/object/CrnTask.js |   31 ++++++++++++++++++++++++++-----
 1 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/static/js/object/CrnTask.js b/static/js/object/CrnTask.js
index ce2ed87..ed48490 100644
--- a/static/js/object/CrnTask.js
+++ b/static/js/object/CrnTask.js
@@ -1,5 +1,5 @@
 // 鍫嗗灈鏈哄綋鍓嶈繍琛岀姸鎬佸璞�
-function CrnTask(crnData) {
+function CrnTask(crnData, object) {
     let that = this;
 
     that.crnNo = 0;
@@ -21,6 +21,10 @@
     that.position = null;
     that.forkPos = -1;
 
+    that.crnBody = null;
+    that.curve = null;
+    that.progress = 0;
+
     let init = function () {
         that.crnNo = crnData.crnNo;
         that.bay = crnData.bay;
@@ -30,6 +34,8 @@
         that.z = crnData.position.z;
         that.position = crnData.position;
         that.forkPos = crnData.forkPos;
+
+        that.crnBody = getArrVal(object.objects, "name", that.crnNo + "-body")
     };
     init();
 
@@ -57,12 +63,27 @@
             that.position = crnData.position;
             that.forkPos = crnData.forkPos;
             // create Route ------------------------------------------------
-            let bodyRoute = new Route([that.prePosition, that.position]);    // body
+            that.curve = new Route([that.prePosition, that.position]);    // body
+
             // new Route();    // load
             // console.log(bodyRoute);
-            // console.log("pre" + JSON.stringify(that.prePosition));
-            // console.log(JSON.stringify(that.position));
-            // that.run = true;
+            console.log("pre" + JSON.stringify(that.prePosition));
+            console.log(JSON.stringify(that.position));
+            that.run = true;
+        }
+    }
+
+    that.move = function (object) {
+        if (that.curve) {
+            that.progress += 0.001;
+            if (that.progress>1.0) {
+                that.curve = null;
+            } else {
+                let point = that.curve.getPoint(that.progress);
+                if(point && point.x){
+                    that.crnBody.position.set(point.x,point.y,point.z);
+                }
+            }
         }
     }
 

--
Gitblit v1.9.1