getPredCircle() { const material = new THREE.MeshBasicMaterial({ color: 0xffffff, transparent: false, opacity: 0.5 }); const circleMesh = drawCircle(0.2, material); this.predCircles.push(circleMesh); return circleMesh; }
update(world, coordinates, scene) { if (!world.gps || !world.autoDrivingCar) { return; } if (!this.circle) { const material = new THREE.MeshBasicMaterial({ color: 0x006aff, transparent: false, opacity: 0.5 }); this.circle = drawCircle(0.2, material); scene.add(this.circle); } if (!this.base) { this.base = drawSegmentsFromPoints( [ new THREE.Vector3(3.89, -1.05, 0), new THREE.Vector3(3.89, 1.06, 0), new THREE.Vector3(-1.04, 1.06, 0), new THREE.Vector3(-1.04, -1.05, 0), new THREE.Vector3(3.89, -1.05, 0)], 0x006aff, 2, 5 ); scene.add(this.base); } const visible = STORE.options["showPositionGps"]; const position = coordinates.applyOffset({ x: world.gps.positionX, y: world.gps.positionY, z: 0, }); this.circle.position.set(position.x, position.y, position.z); this.circle.visible = visible; this.base.position.set(position.x, position.y, position.z); this.base.rotation.set(0, 0, world.gps.heading); this.base.visible = visible; }