Skip to content Skip to sidebar Skip to footer

Cesium - Using Camera To Scale A Polygon To Match Lat-lon Positions While Zoom-in/zoom-out

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 rotation (or camera move)

Solution 1:

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.

Post a Comment for "Cesium - Using Camera To Scale A Polygon To Match Lat-lon Positions While Zoom-in/zoom-out"