人生啊人生 10 bulan lalu
induk
melakukan
553e32e203

+ 2 - 447
src/components/student/CourseChapter3d.vue

@@ -3,7 +3,6 @@
 import CourseChapter3dMain from '@/components/student/CourseChapter3dMain.vue';
 import { threeWorld } from "@/stores/threeWorld.ts";
 import { courseChapter3dShow } from "@/stores/courseChapter3dShow.ts";
-import { RenderEvent } from "@/components/student/event/RenderEvent.ts";
 import { ref, watch } from "vue";
 
 const props = defineProps({
@@ -32,8 +31,7 @@ const emits = defineEmits([
 //     );
 // }, 1000);
 
-// 3d渲染帧事件处理
-let objRenderEvent = new RenderEvent();
+
 
 // 【开发的时候】3d场景,iframe地址
 let threeWorldUrl = "3dMain/index.html#/main?id=zidingyi";
@@ -233,31 +231,6 @@ const carMoveSpeedInitEvent = () => {
     
 }
 
-
-/**
- * 初始化 3d渲染帧事件处理
- */
-const objRenderEventInit = () => {
-    
-    // @ts-ignore
-    objRenderEvent.BABYLON = threeWorld().obj.newIframe.objIframe.BABYLON;
-    // @ts-ignore
-    objRenderEvent.ChengGuangYuanJing = threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing;
-    // @ts-ignore
-    objRenderEvent.objIframe = threeWorld().obj.newIframe.objIframe;
-
-    // 设置回调方法
-    objRenderEvent.tipsBtnsUpOpenEventCallback = function(open : Boolean) {
-        tipsBtnsUpOpenEvent(open);
-    }
-
-    objRenderEvent.tipsBtnsDownOpenEventCallback = function(open : Boolean) {
-        tipsBtnsDownOpenEvent(open);
-    }
-    
-}
-
-
 setInterval(function() {
 
     // 如果没有加载完成,则不触发后面的逻辑
@@ -424,410 +397,6 @@ const threeEvent = () => {
     
 }
 
-// 是否因为,移动后停止了
-let moveToStop = true;
-
-// 控制播放超速声音的时间戳,不需要太频繁播放声音
-let speedingMusicPlayTime = 0;
-
-/**
- * 通过车的不同状态,控制前进还是倒退的逻辑
- */
-const carStatusEvent = () => {
-
-    // console.log(
-
-    //     "carStatusEvent = () => {",
-    //     courseChapter3dShow().show.carStatus,
-    //     courseChapter3dShow().show.carMoveLv,
-    //     courseChapter3dShow().show.carMoveSpeed,
-
-    // );
-
-
-    // 超速提示
-    courseChapter3dShow().show.showCarEyeViewBoolSpeeding = courseChapter3dShow().show.carMoveLv >= 8 ? true : false;
-
-    var thisTime = new Date().getTime();
-    
-    if (
-        // 如果超速
-        courseChapter3dShow().show.showCarEyeViewBoolSpeeding == true
-        && (thisTime - speedingMusicPlayTime) >= 3500
-    ) {
-        
-    }
-
-
-    // 得到最顶部距离的值
-    let showCarEyeDistanceMax = (pipelineProblemsArrayEventList.length - 2 - distanceXBoolSum) * 29.94;
-    showCarEyeDistanceMax -= (29.94 / 2);
-
-    // 由于多出了个出生点与坐标点的距离差
-    showCarEyeDistanceMax += courseChapter3dShow().show.lineDistance;
-    
-    // console.log(
-    //     " 得到最顶部距离的值 showCarEyeDistanceMax ",
-    //     showCarEyeDistanceMax
-    // );
-
-    // console.log(
-    //     "距离判断是否到最顶位置",
-    //     // pipelineProblemsArrayEventList.length,
-    //     // showCarEyeDistanceMax,
-    //     // courseChapter3dShow().show.showCarEyeDistance,
-    //     // courseChapter3dShow().show.birthPointRecord,
-    //     // courseChapter3dShow().show.carPointRecord,
-
-    //     // courseChapter3dShow().show.birthPointRecord.x,
-    //     // courseChapter3dShow().show.carPointRecord.x,
-    // );
-
-    if (
-        // 前视
-        courseChapter3dShow().show.lookAfterOrFront == "front"
-        // && courseChapter3dShow().show.showCarEyeDistance >= 476
-        && courseChapter3dShow().show.showCarEyeDistance >= showCarEyeDistanceMax
-    ) {
-        courseChapter3dShow().show.showCarEyeViewBoolSpeeding2 = true;
-    } else if (
-        // 后视
-        courseChapter3dShow().show.lookAfterOrFront == "after"
-        // && courseChapter3dShow().show.showCarEyeDistance <= 7.3
-        && courseChapter3dShow().show.showCarEyeDistance <= 1
-    ) {
-        courseChapter3dShow().show.showCarEyeViewBoolSpeeding2 = true;
-    } else {
-        courseChapter3dShow().show.showCarEyeViewBoolSpeeding2 = false;
-    }
-
-    // 如果是停止移动了
-    if (courseChapter3dShow().show.carStatus == "stopMove") {
-
-        // 此时说明要停止移动了
-        if (moveToStop == false) {
-
-            // 触发键盘的停止逻辑
-
-            // @ts-ignore 
-            threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.EventMoveRole.find().moveState = 0;
-            // @ts-ignore 
-            threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolW = false;
-            // @ts-ignore 
-            threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolA = false;
-            // @ts-ignore 
-            threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolS = false;
-            // @ts-ignore 
-            threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolD = false;
-
-            // @ts-ignore 恢复初始的移动速度
-            threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.Role.find().speed = courseChapter3dShow().show.carMoveSpeed;
-            
-            moveToStop = true;
-
-        }
-
-        return;
-    }
-
-    moveToStop = false;
-
-    // 根据不同的挡位,控制合理的移动速度
-    let speed = courseChapter3dShow().show.carMoveSpeed
-    * (courseChapter3dShow().show.carMoveLv / courseChapter3dShow().show.carMoveSpeedMultipleMax * 1);
-    
-    // // @ts-ignore 更新目标角色的参数
-    // threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.Role.find().modelRoleCreateOrUpdate(
-    //     // @ts-ignore 
-    //     threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.Role.find().roleCode,
-    //     {
-    //         "addMoveSpeed" : courseChapter3dShow().show.carMoveSpeed - speed,
-    //         "addMoveSpeedSecond" : 3,
-    //         "addMoveSpeedSecondTimeUpdate" : new Date().getTime()
-    //     }
-    // );
-
-    // @ts-ignore
-    threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.Role.find().speed = speed;
-    
-    // 前进
-    if (courseChapter3dShow().show.carStatus == "forwardMove") {
-
-        // @ts-ignore 
-        threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.EventMoveRole.find().moveState = 1;
-        // @ts-ignore 
-        threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolW = true;
-        // @ts-ignore 
-        threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolA = false;
-        // @ts-ignore 
-        threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolS = false;
-        // @ts-ignore 
-        threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolD = false;
-    }
-
-    // 后退
-    if (courseChapter3dShow().show.carStatus == "retreatMove") {
-
-        // @ts-ignore 
-        threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.EventMoveRole.find().moveState = 1;
-        // @ts-ignore 
-        threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolS = true;
-        // @ts-ignore 
-        threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolA = false;
-        // @ts-ignore 
-        threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolW = false;
-        // @ts-ignore 
-        threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonEvent.find().boolD = false;
-
-    }
-
-    // console.log(
-    //     " carStatusEvent = () => { 移动速度 ",
-    //     speed
-    // );
-    
-}
-
-/**
- * 通过每帧的方式来控制变化的
- * courseChapter3dShow().show.carCameraAlphaNew
- * courseChapter3dShow().show.carCameraBetaNew
- * …… 左右旋转,上下旋转,镜头放大缩小
- * 等逻辑
- * 跟 车机器人相关的逻辑
- * 
- */
-const carCameraAlphaAndBetaNew = () => {
-    
-    // 可旋转角度
-    let mathPiMax = Math.PI / 2;
-    let mathPiMax2 = Math.PI / 10;
-
-    // fov每次变化参数
-    let fovUpdate = 0.2;
-
-    // fov最大值
-    let fovMax = 1.6;
-    // fov最小值
-    let fovMin = 0.4;
-
-    // 帧数
-    let fps = 75;
-    // 完成秒数
-    let secondFps = fps * 1.5;
-    let secondFps2 = fps * 1.5;
-    let secondFps3 = fps * 3;
-
-    // y轴支架每次变化的参数
-    let yUpdate = 1 / 2;
-    // let yUpdate = 1;
-
-    // y轴支架最大值
-    let yMax = 1.5;
-    // y轴支架最小值
-    let yMin = 0;
-
-    // 车速
-    // let carMoveLvProportionMax = 100 * 50;
-    let carMoveLvProportionMax = 100;
-
-    // 车相机左右旋转
-    if (courseChapter3dShow().show.carCameraAlpha != courseChapter3dShow().show.carCameraAlphaNew) {
-
-        let distance = courseChapter3dShow().show.carCameraAlpha - courseChapter3dShow().show.carCameraAlphaNew;
-        if (distance > 0) {
-            courseChapter3dShow().show.carCameraAlphaNew += mathPiMax / secondFps3;
-            if (courseChapter3dShow().show.carCameraAlphaNew >= courseChapter3dShow().show.carCameraAlpha) {
-                courseChapter3dShow().show.carCameraAlphaNew = courseChapter3dShow().show.carCameraAlpha;
-            }
-
-        } else {
-            courseChapter3dShow().show.carCameraAlphaNew -= mathPiMax / secondFps3;
-            if (courseChapter3dShow().show.carCameraAlphaNew <= courseChapter3dShow().show.carCameraAlpha) {
-                courseChapter3dShow().show.carCameraAlphaNew = courseChapter3dShow().show.carCameraAlpha;
-            }
-        }
-        
-        if (courseChapter3dShow().show.carCameraAlphaNew >= mathPiMax) {
-            courseChapter3dShow().show.carCameraAlphaNew = mathPiMax;
-        }
-
-        if (courseChapter3dShow().show.carCameraAlphaNew <= -mathPiMax) {
-            courseChapter3dShow().show.carCameraAlphaNew = -mathPiMax;
-        }
-
-    }
-
-    // 车相机上下旋转
-    if (courseChapter3dShow().show.carCameraBeta != courseChapter3dShow().show.carCameraBetaNew) {
-
-        let distance = courseChapter3dShow().show.carCameraBeta - courseChapter3dShow().show.carCameraBetaNew;
-        if (distance > 0) {
-            courseChapter3dShow().show.carCameraBetaNew += mathPiMax / secondFps3;
-            if (courseChapter3dShow().show.carCameraBetaNew >= courseChapter3dShow().show.carCameraBeta) {
-                courseChapter3dShow().show.carCameraBetaNew = courseChapter3dShow().show.carCameraBeta;
-            }
-
-        } else {
-            courseChapter3dShow().show.carCameraBetaNew -= mathPiMax / secondFps3;
-            if (courseChapter3dShow().show.carCameraBetaNew <= courseChapter3dShow().show.carCameraBeta) {
-                courseChapter3dShow().show.carCameraBetaNew = courseChapter3dShow().show.carCameraBeta;
-            }
-        }
-        
-        if (courseChapter3dShow().show.carCameraBetaNew >= mathPiMax) {
-            courseChapter3dShow().show.carCameraBetaNew = mathPiMax;
-        }
-
-        if (courseChapter3dShow().show.carCameraBetaNew <= -mathPiMax) {
-            courseChapter3dShow().show.carCameraBetaNew = -mathPiMax;
-        }
-
-    }
-
-    // 车左右转弯
-    if (courseChapter3dShow().show.carCameraAlphaWheel != courseChapter3dShow().show.carCameraAlphaWheelNew) {
-
-        let distance = courseChapter3dShow().show.carCameraAlphaWheel - courseChapter3dShow().show.carCameraAlphaWheelNew;
-        if (distance > 0) {
-            courseChapter3dShow().show.carCameraAlphaWheelNew += mathPiMax2 / secondFps2;
-            if (courseChapter3dShow().show.carCameraAlphaWheelNew >= courseChapter3dShow().show.carCameraAlphaWheel) {
-                courseChapter3dShow().show.carCameraAlphaWheelNew = courseChapter3dShow().show.carCameraAlphaWheel;
-            }
-
-        } else {
-            courseChapter3dShow().show.carCameraAlphaWheelNew -= mathPiMax2 / secondFps2;
-            if (courseChapter3dShow().show.carCameraAlphaWheelNew <= courseChapter3dShow().show.carCameraAlphaWheel) {
-                courseChapter3dShow().show.carCameraAlphaWheelNew = courseChapter3dShow().show.carCameraAlphaWheel;
-            }
-        }
-
-        if (courseChapter3dShow().show.carCameraAlphaWheelNew >= mathPiMax2) {
-            courseChapter3dShow().show.carCameraAlphaWheelNew = mathPiMax2;
-        }
-
-        if (courseChapter3dShow().show.carCameraAlphaWheelNew <= -mathPiMax2) {
-            courseChapter3dShow().show.carCameraAlphaWheelNew = -mathPiMax2;
-        }
-
-    }
-
-    // 车相机是否放大
-    if (courseChapter3dShow().show.carCameraFov != courseChapter3dShow().show.carCameraFovNew) {
-
-        let distance = courseChapter3dShow().show.carCameraFov - courseChapter3dShow().show.carCameraFovNew;
-        if (distance > 0) {
-            courseChapter3dShow().show.carCameraFovNew += fovUpdate / secondFps;
-            if (courseChapter3dShow().show.carCameraFovNew >= courseChapter3dShow().show.carCameraFov) {
-                courseChapter3dShow().show.carCameraFovNew = courseChapter3dShow().show.carCameraFov;
-            }
-
-        } else {
-            courseChapter3dShow().show.carCameraFovNew -= fovUpdate / secondFps;
-            if (courseChapter3dShow().show.carCameraFovNew <= courseChapter3dShow().show.carCameraFov) {
-                courseChapter3dShow().show.carCameraFovNew = courseChapter3dShow().show.carCameraFov;
-            }
-        }
-
-        if (courseChapter3dShow().show.carCameraFovNew >= fovMax) {
-            courseChapter3dShow().show.carCameraFovNew = fovMax;
-        }
-
-        if (courseChapter3dShow().show.carCameraFovNew <= fovMin) {
-            courseChapter3dShow().show.carCameraFovNew = fovMin;
-        }
-
-    }
-
-    // 支架上升还是下降
-    if (courseChapter3dShow().show.carCameraPositionY != courseChapter3dShow().show.carCameraPositionYNew) {
-
-        let distance = courseChapter3dShow().show.carCameraPositionY - courseChapter3dShow().show.carCameraPositionYNew;
-        if (distance > 0) {
-
-            courseChapter3dShow().show.carCameraPositionYNew += yUpdate / secondFps;
-            if (courseChapter3dShow().show.carCameraPositionYNew >= courseChapter3dShow().show.carCameraPositionY) {
-                courseChapter3dShow().show.carCameraPositionYNew = courseChapter3dShow().show.carCameraPositionY;
-            }
-
-        } else {
-
-            courseChapter3dShow().show.carCameraPositionYNew -= yUpdate / secondFps;
-            if (courseChapter3dShow().show.carCameraPositionYNew <= courseChapter3dShow().show.carCameraPositionY) {
-                courseChapter3dShow().show.carCameraPositionYNew = courseChapter3dShow().show.carCameraPositionY;
-            }
-
-        }
-
-        if (courseChapter3dShow().show.carCameraPositionYNew >= yMax) {
-            courseChapter3dShow().show.carCameraPositionYNew = yMax;
-        }
-
-        if (courseChapter3dShow().show.carCameraPositionYNew <= yMin) {
-            courseChapter3dShow().show.carCameraPositionYNew = yMin;
-        }
-
-    }
-
-    // 车速变动百分比
-    if (courseChapter3dShow().show.carMoveLvProportion != courseChapter3dShow().show.carMoveLvProportionNew) {
-
-        let distance = courseChapter3dShow().show.carMoveLvProportion - courseChapter3dShow().show.carMoveLvProportionNew;
-        if (distance > 0) {
-
-            courseChapter3dShow().show.carMoveLvProportionNew += carMoveLvProportionMax / secondFps;
-            if (courseChapter3dShow().show.carMoveLvProportionNew >= courseChapter3dShow().show.carMoveLvProportion) {
-                courseChapter3dShow().show.carMoveLvProportionNew = courseChapter3dShow().show.carMoveLvProportion;
-            }
-
-        } else {
-
-            courseChapter3dShow().show.carMoveLvProportionNew -= carMoveLvProportionMax / secondFps;
-            if (courseChapter3dShow().show.carMoveLvProportionNew <= courseChapter3dShow().show.carMoveLvProportion) {
-                courseChapter3dShow().show.carMoveLvProportionNew = courseChapter3dShow().show.carMoveLvProportion;
-            }
-
-        }
-
-        // if (courseChapter3dShow().show.carMoveLvProportionNew >= 100) {
-        //     courseChapter3dShow().show.carMoveLvProportionNew = 100;
-        // }
-
-        // if (courseChapter3dShow().show.carMoveLvProportionNew <= 0) {
-        //     courseChapter3dShow().show.carMoveLvProportionNew = 0;
-        // }
-
-        if (courseChapter3dShow().show.carMoveLvProportionNew >= 96) {
-            courseChapter3dShow().show.carMoveLvProportionNew = 96;
-        }
-
-        if (courseChapter3dShow().show.carMoveLvProportionNew <= 3) {
-            courseChapter3dShow().show.carMoveLvProportionNew = 3;
-            courseChapter3dShow().show.bottomSpeedImgTopSptWidth = '0rem';
-        } else {
-            // courseChapter3dShow().show.bottomSpeedImgTopSptWidth = '2.6rem';
-            courseChapter3dShow().show.bottomSpeedImgTopSptWidth = '2rem';
-        }
-
-        // 最大的例子所在位置
-        let topRemMax = 6;
-        // let topRemMax = 8;
-
-        if (courseChapter3dShow().show.carMoveLvProportionNew <= 50) {
-
-            courseChapter3dShow().show.carMoveLvProportionTopNew = -(topRemMax * courseChapter3dShow().show.carMoveLvProportionNew / 100);
-            
-        } else {
-
-            courseChapter3dShow().show.carMoveLvProportionTopNew = -(topRemMax * ( 100 - courseChapter3dShow().show.carMoveLvProportionNew) / 100);
-
-        }
-        
-
-    }
-    
-}
-
 /**
  * 3d加载完成优先切换到默认的视角
  */
@@ -864,15 +433,7 @@ const initScene = () => {
  * 将所有设置为地面的,改为不设置为地面
  */
 const groundNoRemove = () => {
-
-    // // 临时测试用的,后续正式,在注释掉
-    // return;
-
-    // console.log(
-    //     "groundNoRemove = () => {",
-    //     threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.ModelObjEdit.find().meshListIdToJson
-    // );
-
+    
     // @ts-ignore
     for (const key in threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.ModelObjEdit.find().meshListIdToJson) {
         
@@ -910,7 +471,6 @@ const groundNoRemove = () => {
 
     // @ts-ignore
     threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.Role.find().isGroundList = {};
-
     // @ts-ignore
     threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.ModelObjEdit.find().myIsGroundConfigNum = 0;
 
@@ -947,16 +507,11 @@ const typeEvent = (type : any) => {
     
 }
 
-// let wearYes = new URL("./../../assets/3dmodel/body.webp", import.meta.url).href;
-let wearYes = new URL("./../../assets/3dmodel/04_M_Construction_d_2.webp", import.meta.url).href;
-let wearNo = new URL("./../../assets/3dmodel/04_M_Construction_d_1.webp", import.meta.url).href;
-
 </script>
 
 <template>
 
     <!-- 3d课程配置:{{ props.config }} -->
-
     <img v-if="courseChapter3dShow().show.threeWorldMask == true" class="threeWorldMask" src="../../assets/student/mask.webp" />
 
     <CourseChapter3dMain

+ 0 - 310
src/components/student/event/RenderEvent.ts

@@ -1,310 +0,0 @@
-import { threeWorld } from "@/stores/threeWorld.ts";
-import { courseChapter3dShow } from "@/stores/courseChapter3dShow.ts";
-
-/**
- * 3d渲染帧事件处理
- */
-export class RenderEvent {
-
-    // 可以被调用的 iframe 对象
-    public objIframe : any = null;
-
-    // 三维对象
-    public ChengGuangYuanJing : any = null;
-
-    // babylon 对象
-    public BABYLON : any = null;
-
-    /**
-     * 上一步是否显示 回调方法
-     * open     true - 显示, false - 隐藏
-     */
-    public tipsBtnsUpOpenEventCallback : any = null;
-    /**
-     * 下一步是否显示 回调方法
-     * open     true - 显示, false - 隐藏
-     */
-    public tipsBtnsDownOpenEventCallback : any = null;
-
-    /**
-     * 上一步是否显示
-     * open     true - 显示, false - 隐藏
-     */
-    public tipsBtnsUpOpenEvent = (open : Boolean) => {
-        if (this.tipsBtnsUpOpenEventCallback != null && this.tipsBtnsUpOpenEventCallback != undefined) {
-            this.tipsBtnsUpOpenEventCallback(open);
-        }
-    }
-
-    /**
-     * 下一步是否显示
-     * open     true - 显示, false - 隐藏
-     */
-    public tipsBtnsDownOpenEvent = (open : Boolean) => {
-        if (this.tipsBtnsDownOpenEventCallback != null && this.tipsBtnsDownOpenEventCallback != undefined) {
-            this.tipsBtnsDownOpenEventCallback(open);
-        }
-    }
-
-    
-    /**
-     * 更新车的一些相关数据,例如,车速,车距灯
-     */
-    public updateCarDb = () => {
-
-        let BABYLON = this.BABYLON;
-
-        // @ts-ignore
-        if (courseChapter3dShow().show.birthPoint["下井检测"] == null || courseChapter3dShow().show.birthPoint["下井检测"] == undefined) {
-            return;
-        }
-
-        // @ts-ignore
-        let thisBirthPoint = courseChapter3dShow().show.birthPoint["下井检测"];
-        // @ts-ignore 角色
-        let car = threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.Role.find().objRole;
-
-        // 原始坐标点
-        let positionStart = thisBirthPoint.position;
-        // 车坐标点
-        let positionCar = car.position;
-
-        courseChapter3dShow().show.birthPointRecord = positionStart;
-        courseChapter3dShow().show.carPointRecord = positionCar;
-
-        
-        // 得到两点之间的距离
-        let thisVector3distanceTo = BABYLON.Vector3.Distance(
-            new BABYLON.Vector3(
-                parseFloat(positionStart.x),
-                parseFloat(positionStart.y),
-                parseFloat(positionStart.z),
-            ),
-            new BABYLON.Vector3(
-                parseFloat(positionCar.x),
-                parseFloat(positionCar.y),
-                parseFloat(positionCar.z),
-            )
-        );
-
-        // console.log(
-        //     "下井检测出生点",
-        //     positionStart,
-        //     positionCar,
-        //     thisVector3distanceTo
-        // );
-
-        if (isNaN(thisVector3distanceTo)) {
-            thisVector3distanceTo = 0;
-        }
-
-        // console.log(
-        //     thisVector3distanceTo,
-        //     courseChapter3dShow().show.showCarEyeDistance
-        // );
-        
-        // 距离不一样,此时说明再移动,则更新车速
-        if (courseChapter3dShow().show.showCarEyeDistance != thisVector3distanceTo) {
-            let speed = thisVector3distanceTo - courseChapter3dShow().show.showCarEyeDistance;
-            if (speed < 0) {
-                speed = -speed;
-            }
-
-            if (("" + speed).indexOf(".") >= 0) {
-                // speed = parseInt(("" + speed).split(".")[0]);
-                // 保留1位小数点
-                speed = Math.round(speed * 10) / 10;
-            }
-            
-            courseChapter3dShow().show.showCarEyeSpeed = speed;
-
-        } else {
-
-            courseChapter3dShow().show.showCarEyeSpeed = 0;
-
-        }
-
-        if (("" + thisVector3distanceTo).indexOf(".") >= 0) {
-            // thisVector3distanceTo = parseInt(("" + thisVector3distanceTo).split(".")[0]);
-            // 保留1位小数点
-            thisVector3distanceTo = Math.round(thisVector3distanceTo * 10) / 10;
-        }
-        
-
-        
-        
-        var line =  courseChapter3dShow().show.lineDistance - (positionStart.x - positionCar.x);
-
-        if (("" + line).indexOf(".") >= 0) {
-            // speed = parseInt(("" + speed).split(".")[0]);
-            // 保留1位小数点
-            line = Math.round(line * 10) / 10;
-        }
-
-
-        // 差距的距离
-        if (positionStart.x > positionCar.x ) {
-            
-        } else {
-            
-        }
-
-
-        courseChapter3dShow().show.showCarEyeDistance = line;
-        
-        // console.log(
-        //     "相差的距离",
-        //     lineDistance,
-        //     line,
-        //     // thisVector3distanceTo
-        // );
-        
-        // courseChapter3dShow().show.showCarEyeDistance = thisVector3distanceTo;
-
-        // courseChapter3dShow().show.showCarEyeDistance = this.rectangle(
-        //     positionCar.x - positionStart.x,
-        //     positionCar.z - positionStart.z
-        // )["line"];
-        
-    }
-
-    /** 根据长宽 得到长方形 以及 直线角度
-     * 参数 w 宽
-     * 参数 h 长
-     * 返回 json
-     * {"W":宽,"H":长,"angle":角度}
-     */
-    public rectangle = function(w : any, h : any) {
-        if(w < 0){
-            w = -w;
-        }
-
-        if(h < 0){
-            h = -h;
-        }
-        // 直线的长度计算【使用勾股定律 a平方【宽】 + b平方【长】 = c平方【斜线】】
-        let line = Math.sqrt(w * w + h * h);
-        return {"W": w, "H": h, "line": line};
-
-    }
-    
-    
-    /**
-     * 每多少毫秒调用一次
-     * 用于判断不同流程是否完成逻辑
-     * 
-     * statue       流程状态
-     */
-    public workEvent = (statue : any) => {
-
-        console.log(
-            "workEvent = () => {", statue
-        );
-
-        let thisObj = this;
-        let BABYLON = this.BABYLON;
-
-        // 多少距离则为范围内
-        let distanceBool = 3;
-        let meshList : any = [];
-        let positionList : any = [];
-        let distanceNum = 0;
-        // @ts-ignore
-        let CommonVal = threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal;
-
-        switch (statue) {
-
-            case '请走到工作区域':
-
-                // 判断是否走到工作区域了
-
-                // @ts-ignore
-                let objRole = threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.Role.find().objRole;
-
-                // 多少距离则为范围内
-                // distanceBool = 3;
-                distanceBool = 5;
-
-                // 得到两点之间的距离
-                let thisVector3distanceTo = BABYLON.Vector3.Distance(
-                    new BABYLON.Vector3(
-                        parseFloat(objRole.position.x),
-                        parseFloat(objRole.position.y),
-                        parseFloat(objRole.position.z),
-                    ),
-                    new BABYLON.Vector3(
-                        // (-30),
-                        // (1.01),
-                        // (1.25)
-                        (-36.80286),
-                        (1.01),
-                        (0.97331)
-                    )
-                );
-
-                // console.log(
-                //     "thisVector3distanceTo", thisVector3distanceTo
-                // );
-
-                if (thisVector3distanceTo <= distanceBool) {
-
-                    // 上一步和下一步是否显示
-                    thisObj.tipsBtnsUpOpenEvent(true);
-                    thisObj.tipsBtnsDownOpenEvent(true);
-
-                    courseChapter3dShow().show.showCongratulationsViewBool = true;
-                    courseChapter3dShow().show.showEndViewBool = true;
-
-                } else {
-
-                    courseChapter3dShow().show.showCongratulationsViewBool = false;
-                    courseChapter3dShow().show.showEndViewBool = false;
-
-                    // 上一步和下一步是否显示
-                    thisObj.tipsBtnsUpOpenEvent(false);
-                    thisObj.tipsBtnsDownOpenEvent(false);
-
-                }
-                
-                break;
-
-        }
-
-
-    }
-
-    /**
-     * 切换挡位的逻辑
-     * type     类型
-     *          add - 增加挡位
-     *          moderate - 减少挡位
-     */
-    public carMoveLvEvent = (type : any) => {
-        
-        switch (type) {
-
-            case 'add':
-                courseChapter3dShow().show.carMoveLv += 1;
-                break;
-
-            case 'moderate':
-                courseChapter3dShow().show.carMoveLv -= 1;
-                break;
-
-        }
-
-        if (courseChapter3dShow().show.carMoveLv >= courseChapter3dShow().show.carMoveSpeedMultipleMax) {
-            courseChapter3dShow().show.carMoveLv = courseChapter3dShow().show.carMoveSpeedMultipleMax;
-        }
-
-        if (courseChapter3dShow().show.carMoveLv <= courseChapter3dShow().show.carMoveSpeedMultipleMin) {
-            courseChapter3dShow().show.carMoveLv = courseChapter3dShow().show.carMoveSpeedMultipleMin;
-        }
-
-        courseChapter3dShow().show.carMoveLvProportion
-        = courseChapter3dShow().show.carMoveLv / courseChapter3dShow().show.carMoveSpeedMultipleMax * 100;
-        
-    }
-
-
-}

+ 2 - 4
src/stores/courseChapter3dShow.ts

@@ -383,10 +383,8 @@ export const courseChapter3dShow = defineStore('courseChapter3dShow', () => {
 
         // 是否显示蒙版
         threeWorldMask : false,
-
-
-
-
+        
+        
     });
     
     return {