| | |
| | | // 堆垛机当前运行状态对象 |
| | | function CrnTask(crnData) { |
| | | function CrnTask(crnData, object) { |
| | | let that = this; |
| | | |
| | | that.crnNo = 0; |
| | |
| | | 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; |
| | |
| | | that.z = crnData.position.z; |
| | | that.position = crnData.position; |
| | | that.forkPos = crnData.forkPos; |
| | | |
| | | that.crnBody = getArrVal(object.objects, "name", that.crnNo + "-body") |
| | | }; |
| | | init(); |
| | | |
| | |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |