|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
import { MTLLoader } from 'three/examples/jsm/loaders/MTLLoader'
|
|
|
|
|
import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader'
|
|
|
|
|
import * as THREE from 'three'
|
|
|
|
|
import { camera, labelRenderer, renderer, scene } from '@/views/board/model/setThree'
|
|
|
|
|
import { camera, labelRenderer, renderer, scene,isLoading } from '@/views/board/model/setThree'
|
|
|
|
|
import * as TWEEN from '@tweenjs/tween.js'
|
|
|
|
|
|
|
|
|
|
let timeOrSpeed = true
|
|
|
|
@ -276,7 +276,7 @@ const AGVAnimationF = (item, type, newLocation = 0, time = 2000) => {
|
|
|
|
|
}
|
|
|
|
|
let distance = location - agvData[AGVLocationData].x
|
|
|
|
|
let tween = new TWEEN.Tween(agvData[group].position)
|
|
|
|
|
.to({ x: location }, Math.abs(distance) / s * 16) // 移动到(1, 1, 1),持续1000毫秒
|
|
|
|
|
.to({ x: location }, Math.abs(distance) / s * 16) // 移动到(1, 1, 1),持续1000毫秒
|
|
|
|
|
.onComplete(() => {
|
|
|
|
|
agvData[group].position.x = location
|
|
|
|
|
agvData[AGVLocationData].x = location
|
|
|
|
@ -335,7 +335,7 @@ const AGVAnimationF = (item, type, newLocation = 0, time = 2000) => {
|
|
|
|
|
let distance = location - agvData[AGVLocationData].z
|
|
|
|
|
|
|
|
|
|
let tween = new TWEEN.Tween(agvData[group].position)
|
|
|
|
|
.to({ z: location }, Math.abs(distance) / s * 16) // 移动到(1, 1, 1),持续1000毫秒
|
|
|
|
|
.to({ z: location }, Math.abs(distance) / s * 16) // 移动到(1, 1, 1),持续1000毫秒
|
|
|
|
|
.onComplete(() => {
|
|
|
|
|
agvData[group].position.z = location
|
|
|
|
|
agvData[AGVLocationData].z = location
|
|
|
|
@ -393,7 +393,7 @@ const AGVAnimationF = (item, type, newLocation = 0, time = 2000) => {
|
|
|
|
|
let bool = (nowRotateNum - endRotateNum) > 0
|
|
|
|
|
|
|
|
|
|
let tween = new TWEEN.Tween(agvData[group].rotation)
|
|
|
|
|
.to({ y: newLocation * (Math.PI / 180) }, 500) // 移动到(1, 1, 1),持续1000毫秒
|
|
|
|
|
.to({ y: newLocation * (Math.PI / 180) }, 500) // 移动到(1, 1, 1),持续1000毫秒
|
|
|
|
|
.onComplete(() => {
|
|
|
|
|
agvData[group].rotation.y = (newLocation * (Math.PI / 180))
|
|
|
|
|
resolve()
|
|
|
|
@ -436,50 +436,53 @@ const AGVAnimation = (e, item, type, newLocation = 0, time = 2000) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setInterval(() => {
|
|
|
|
|
let num1_1 = Math.random()
|
|
|
|
|
let num1_2 = Math.random()
|
|
|
|
|
let num1_3 = Math.random()
|
|
|
|
|
let num1_4 = Math.random()
|
|
|
|
|
let num1_5 = Math.random()
|
|
|
|
|
|
|
|
|
|
if (num1_1 > 0.5) {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('2AGV', '2AGV', 'x', num2)
|
|
|
|
|
} else {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('2AGV', '2AGV', 'z', num2)
|
|
|
|
|
}
|
|
|
|
|
if (isLoading) {
|
|
|
|
|
let num1_1 = Math.random()
|
|
|
|
|
let num1_2 = Math.random()
|
|
|
|
|
let num1_3 = Math.random()
|
|
|
|
|
let num1_4 = Math.random()
|
|
|
|
|
let num1_5 = Math.random()
|
|
|
|
|
|
|
|
|
|
if (num1_2 > 0.5) {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('3AGV', '3AGV', 'x', num2)
|
|
|
|
|
} else {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('3AGV', '3AGV', 'z', num2)
|
|
|
|
|
}
|
|
|
|
|
if (num1_1 > 0.5) {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('2AGV', '2AGV', 'x', num2)
|
|
|
|
|
} else {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('2AGV', '2AGV', 'z', num2)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (num1_3 > 0.5) {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('5CCAGV', '5CCAGV', 'x', num2)
|
|
|
|
|
} else {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('5CCAGV', '5CCAGV', 'z', num2)
|
|
|
|
|
}
|
|
|
|
|
if (num1_2 > 0.5) {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('3AGV', '3AGV', 'x', num2)
|
|
|
|
|
} else {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('3AGV', '3AGV', 'z', num2)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (num1_4 > 0.5) {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('5BFAGV', '5BFAGV', 'x', num2)
|
|
|
|
|
} else {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('5BFAGV', '5BFAGV', 'z', num2)
|
|
|
|
|
}
|
|
|
|
|
if (num1_3 > 0.5) {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('5CCAGV', '5CCAGV', 'x', num2)
|
|
|
|
|
} else {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('5CCAGV', '5CCAGV', 'z', num2)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (num1_5 > 0.5) {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('5CTU', '5CTU', 'x', num2)
|
|
|
|
|
} else {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('5CTU', '5CTU', 'z', num2)
|
|
|
|
|
if (num1_4 > 0.5) {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('5BFAGV', '5BFAGV', 'x', num2)
|
|
|
|
|
} else {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('5BFAGV', '5BFAGV', 'z', num2)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (num1_5 > 0.5) {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('5CTU', '5CTU', 'x', num2)
|
|
|
|
|
} else {
|
|
|
|
|
let num2 = Math.random() * 100
|
|
|
|
|
AGVAnimation('5CTU', '5CTU', 'z', num2)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, 1000)
|
|
|
|
|
|
|
|
|
|