Cesium - using camera to scale a polygon to match Lat-Lon positions while zoom-in/zoom-out

后端 未结 1 1330
一生所求
一生所求 2021-01-16 02:01

I am struggling with camera functionality that (I think) would provide a way to force my polygon to stick to the top of my house on zoom-out, zoom-in, and r

1条回答
  •  孤城傲影
    2021-01-16 02:42

    The correct value for mousePosition is a Cartesian2 containing window coordinates, not a Cartesian3. Such mouse coordinates usually come from a callback from Cesium.ScreenSpaceEventHandler, but can also be constructed from native JavaScript mouse/touch events.

    If you inspect the contents of mousePosition, you should find x and y values in window pixel coordinates.

    I see you edited the question to include the contents of mousePosition, and it looks like the mouse coordinates have already been converted into ellipsoid Cartesian3 coordinates, which will prevent this code from working. You want original mouse coordinates going directly into scene.pickPosition for this to work.

    0 讨论(0)
提交回复
热议问题