I’ve integrated cesium with three js using this tutorial:
In 3D mode it works as expected. But in 2D and CV mode it doesn’t: the positions are off.
I found this function for calculating the actual position in Cesium’s source code: cesium/SceneTransforms.js at master · CesiumGS/cesium · GitHub
It works for Columbus view, but not in 2D. The objects seem to be too high above and aren’t correctly positioned when moving/zooming the camera.
P.S. For Columbus view I use this function:
const transformCV = (pos: Cartesian3) => {
const temp = cartToVec(cesium.scene.mapProjection.project(Ellipsoid.WGS84.cartesianToCartographic(pos)));
return Cartesian3.fromArray([temp.z, temp.x, temp.y]);
}
According to the source code, it should be like this in 2D:
const transform2D = (pos: Cartesian3) => {
const temp = cartToVec(cesium.scene.mapProjection.project(Ellipsoid.WGS84.cartesianToCartographic(pos)));
return Cartesian3.fromArray([0, temp.x, temp.y]);
}
But it doesn’t work