分享
查看: 20|回复: 0

[求助] 坐标拾取错误

[复制链接]

坐标拾取错误

发表于 2025-5-17 17:29:17 来自 求助 阅读模式 倒序浏览
在线部署后跑着服务器上坐标拾取有问题,坐标获取的不准确,在线开发的时候是正常的,屏幕坐标转世界坐标,ev.pickPosition 这两个获取的未知都不准确
  1. app.on('click', function (ev) {
  2.     if (ev.button == 2) {
  3.         // 屏幕坐标
  4.         let screenPosition = [ev.clientX, ev.clientY]
  5.         // 世界坐标
  6.         let worldPosition = app.camera.screenToWorld(ev.clientX, ev.clientY)
  7.         worldPosition[1] = 2
  8.         globalMethods.openRightMenu(screenPosition, worldPosition)

  9.     }
  10. })
复制代码
场景加载代码如下
  1. var app = new THING.App(/**/{
  2.     // url: '/api/scene/58af18d4e54718f3dfb257a0', // 残缺的 小体积
  3.     // url: '/api/scene/71eb99b5017d491d08713aa9', // 完整的 大体积
  4.     url: './scene/2/', // online
  5.     background: basePreFix + '/uploads/wechat/1113910/file/VehicleBaseDigitalTwin3DVisualizationSystem/index/src/img/background.png'
  6. });
复制代码


avatar
游客~
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

130700ppkpl8x3t7tt1b1t