Hi there,
i’m new on Cesium, and i’m using it with Resium on a react app
i’m using 3D tiles and my goal is to insert a PointGraphic on clic location. but if the location is good without 3D layer, with it the final Entity location is wrong.
on this picture we cans see the blue pin, i’have clicked on the bottom right of the square
and on this second one, without 3D tiles, the entity location is good
my onClick code :
const handleMapClick = (e: any) => {
if (viewer.current?.cesiumElement && e.position) {
const v = viewer.current.cesiumElement;
const ellipsoid = Ellipsoid.WGS84;
const cartesian2Coordinates = new Cartesian2(e.position.x, e.position.y);
const ray = v.camera.getPickRay(cartesian2Coordinates);
if (ray) {
const position = v.scene.globe.pick(ray, v.scene);
if (position) {
const positionCartographic = ellipsoid.cartesianToCartographic(position);
const lng = Math.toDegrees(positionCartographic.longitude);
const lat = Math.toDegrees(positionCartographic.latitude);
dispatch(mapActions.setClicked3dPoint({ lat, lng }));
}
}
}
};
seems the error comes from the space between 2D and 3D tiles, and the persepctive does the rest
how can adjust the location for 3D tiles?
thx