本文介绍了不与模型互动时的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}
有关此方法的信息,请参见非官方文档(非权威性,如有更改,恕不另行通知).此处
See unofficial doc (not authoritative & subject to change w/o notice) for this method here
这篇关于不与模型互动时的ClientToWorld值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!