浏览代码

3dModeling buildingCreate.js 徐寅秋 commit at 2021-03-24

徐寅秋 4 年之前
父节点
当前提交
a72c01d60b
共有 1 个文件被更改,包括 34 次插入0 次删除
  1. 34 0
      3dModeling/zyl282/buildingCreate.js

+ 34 - 0
3dModeling/zyl282/buildingCreate.js

@@ -355,3 +355,37 @@ function registerEvent() {
             return;
         }
         stopRotate();
+        if (showControlTimer == null) {
+            $('#all-controls').css('display', 'none');
+            showControlTimer = setInterval(function () {
+                count++;
+                if (count >= 2) {
+                    $('#all-controls').css('display', 'block');
+                    restarRotate();
+                    clearInterval(showControlTimer);
+                    showControlTimer = null;
+                }
+            }, 300);
+        }
+    }, '摄像机前后滚动,功能图片隐藏');
+
+    // 鼠标移动事件,已创建的红色胶囊跟随鼠标移动
+    app.on(THING.EventType.MouseMove, function (ev) {
+        if (box != null) {
+            if (ev.picked) {
+                box.position = ev.pickedPosition;
+            }
+        }
+    });
+    // 摄像机位置改变结束事件,记录当前摄像机位置与目标点x,y,z的差
+    app.on(THING.EventType.CameraChangeEnd, function () {
+        if (cameraDistace.length > 0) {
+            let caPos = app.camera.position;
+            let scePos = app.root.defaultCampus.position;
+            cameraDistace = [caPos[0] - scePos[0], caPos[1] - scePos[1], caPos[2] - scePos[2]];
+        }
+        restarRotate();
+    });
+    // 点击事件,放置红色胶囊,进入第一人称行走
+    app.on(THING.EventType.Click, function (ev) {
+        stopRotate();