不与模型交互时的 ClientToWorld 值 [英] ClientToWorld value when not interacting with model

查看:25
本文介绍了不与模型交互时的 ClientToWorld 值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有类似于 ClientToWorld 的方法,如果我提供 X,Y 屏幕坐标,它可以给我 X,Y 世界坐标?

Is there a method similar to ClientToWorld, that can give me the X,Y world coords if I provide it with X,Y screen coords?

我知道 ClientToWorld 为我提供了它与模型交互位置的 Z 坐标,但我很高兴没有 Z 坐标,因为它不会将光线投射到模型上的某个点.

I know that ClientToWorld gives me a Z coord of where it interacts with the model, but I am happy to have no Z coord as it will not raycast to a point on the model.

推荐答案

Viewer3dImpl.clientToViewport怎么样?

let coords = viewer.impl.clientToViewport(client.x, client.y); //c.Vector3 {x: -0.9696521095484826, y: 0.9200779727095516, z: 1 (always 1)}
let finalCoords = coords.unproject(viewer.impl.camera) //c.Vector3 {x: -26.379134321221724, y: 5.162777223710702, z: 1.3846547842336627}

有关此方法,请参阅非官方文档(不具有权威性,如有更改,恕不另行通知)这里

这篇关于不与模型交互时的 ClientToWorld 值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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