首页 > 解决方案 > 从 Babylon.js 中的屏幕坐标获取 wold 坐标

问题描述

我没有使用地面。我想让pickPoint动态添加网格。

scene.onPointerDown = function (evt, pickResult) {
     // if the click hits the ground object, we change the impact position
     if (pickResult.hit) {
         console.log('an object is picked');
     } else {
         console.log('get world coordinates from evt.x and evt.y');
     }
};

标签: babylonjs

解决方案


pickResult 对象有一个名为 的变量pickedPoint

这是一个快速演示:

https://playground.babylonjs.com/#NU4F6Y#0


推荐阅读