在全景 GUI 中查找 ThreeJS 坐标? [英] Find ThreeJS coordinates in Panoramic GUI?

查看:25
本文介绍了在全景 GUI 中查找 ThreeJS 坐标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我过去曾玩过 ThreeJS,现在正在一个新项目中尝试在全景中设置热点.我记得使用相机推车:http://davidpaulrosser.github.io/threejs-camera-dolly/ 以获得相机位置的良好视觉效果,但是否有人想出一个可以让您获得 xyz 坐标的方法,例如在此 ThreeJS 示例 http://threejs.org/examples/css3d_panorama.html 你想在路上放置一个热点.

I have played with ThreeJS a little in the past and am on a new project trying to setup hotspots in a panoramic. I remember using the camera dolly: http://davidpaulrosser.github.io/threejs-camera-dolly/ to get a nice visual of camera locations, but has anyone worked out one that would let you get the xyz coordinates if for instance on this ThreeJS example http://threejs.org/examples/css3d_panorama.html you wanted to place a hotspot on the road.

它可以使用与相机小车使用的 dat gui 相同的东西,或者是一个你拖动的球来报告它的位置.

It could use the same thing as the dat gui that the camera dolly uses, or be a ball you drag around that reports it's location.

推荐答案

所以您只是希望能够将全景图像转换为 3d 位置,以便您可以在那里保存一些内容并稍后进行渲染?像这样的东西会给你你需要的位置..

So you just want to be able to convert from a panoramic image to 3d location, so you can save something there and render it later? Something like this will give you the location you need..

https://jsfiddle.net/mz7Lv9dt/1( 修正了一个错字)

您可能感兴趣的部分在这里:

The part that probably interests you is here:

var raycaster = new THREE.Raycaster();
raycaster.setFromCamera( uv, cam );
return raycaster.intersectObjects( objects );

拖动绿球以获取其位置(始终设置为单位长度)

Drag the green ball around to get its location (always set to unit length of one)

如果我完全回答错了,请告诉我.

If I totally answered wrong let me know.

这篇关于在全景 GUI 中查找 ThreeJS 坐标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆