|
|
@ -396,13 +396,13 @@ export default class Cl23dObject extends THREE.Object3D { |
|
|
try { |
|
|
try { |
|
|
// 安全连接配置
|
|
|
// 安全连接配置
|
|
|
const client = |
|
|
const client = |
|
|
mqtt.connect('mqtt://127.0.0.1:9001', { |
|
|
mqtt.connect('mqtt://10.10.203.239:9001', { |
|
|
path: '/mqtt', |
|
|
path: '/mqtt', |
|
|
clientId: 'virtual-' + item.id, |
|
|
clientId: 'virtual-' + item.id, |
|
|
clean: true, |
|
|
clean: true, |
|
|
connectTimeout: 10000, |
|
|
connectTimeout: 10000, |
|
|
username: 'user', |
|
|
username: 'admin', |
|
|
password: 'user', |
|
|
password: 'admin', |
|
|
unixSocket: true, |
|
|
unixSocket: true, |
|
|
keepalive: 60, |
|
|
keepalive: 60, |
|
|
}); |
|
|
}); |
|
|
@ -459,7 +459,7 @@ export default class Cl23dObject extends THREE.Object3D { |
|
|
//当队列为空时,检查当前车辆所在位置
|
|
|
//当队列为空时,检查当前车辆所在位置
|
|
|
const pointItem = Model.getItemByXYZ(this.position.x, this.position.y, this.position.z) |
|
|
const pointItem = Model.getItemByXYZ(this.position.x, this.position.y, this.position.z) |
|
|
if (!pointItem || data.content.StartX != pointItem.logicX || data.content.StartY != pointItem.logicY) { |
|
|
if (!pointItem || data.content.StartX != pointItem.logicX || data.content.StartY != pointItem.logicY) { |
|
|
throw new Error('当前车辆所在位置未找到') |
|
|
// throw new Error('当前车辆所在位置未找到')
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -530,19 +530,29 @@ export default class Cl23dObject extends THREE.Object3D { |
|
|
} |
|
|
} |
|
|
while (this.taskList.length > 0) { |
|
|
while (this.taskList.length > 0) { |
|
|
const task = this.taskList[0] |
|
|
const task = this.taskList[0] |
|
|
|
|
|
if (this.currentTask == null) { |
|
|
|
|
|
this.currentTask = task |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (task.OperationType == 0 && ((task.Speed > 0) != (this.currentTask.Speed > 1) || task.Direction != this.currentTask.Direction)) { |
|
|
if (task.OperationType == 0 |
|
|
|
|
|
&& ((task.Speed > 0) != (this.currentTask.Speed > 0) || task.Direction != this.currentTask.Direction)) { |
|
|
if (!this.currentAnimation || this.currentAnimation == this.rotationAnimation) { |
|
|
if (!this.currentAnimation || this.currentAnimation == this.rotationAnimation) { |
|
|
// 转向
|
|
|
// 转向
|
|
|
this.addRotation(task.Direction) |
|
|
this.addRotation(task.Direction).then(()=>{ |
|
|
this.currentAnimation = task |
|
|
this.executeTask() |
|
|
|
|
|
}) |
|
|
|
|
|
this.currentAnimation = this.rotationAnimation |
|
|
|
|
|
this.currentTask = task |
|
|
} |
|
|
} |
|
|
} else if (task.OperationType === 0) { |
|
|
} else if (task.OperationType === 0) { |
|
|
if (!this.currentAnimation || this.currentAnimation == this.travelAnimation) { |
|
|
if (!this.currentAnimation || this.currentAnimation == this.travelAnimation) { |
|
|
this.taskList.shift() |
|
|
this.taskList.shift() |
|
|
this.addTravel(task.X, task.Y, task.Speed / 1000) |
|
|
this.addTravel(task.X, task.Y, task.Speed / 1000) |
|
|
this.currentAnimation = task |
|
|
this.currentAnimation = this.travelAnimation |
|
|
|
|
|
this.currentTask = task |
|
|
} |
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -676,7 +686,8 @@ export default class Cl23dObject extends THREE.Object3D { |
|
|
onComplete: () => { |
|
|
onComplete: () => { |
|
|
this.travelAnimation = null |
|
|
this.travelAnimation = null |
|
|
this.currentAnimation = null |
|
|
this.currentAnimation = null |
|
|
resolve() |
|
|
this.executeTask() |
|
|
|
|
|
// resolve()
|
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
this.currentAnimation = this.travelAnimation |
|
|
this.currentAnimation = this.travelAnimation |
|
|
|