var ellipsoid = viewer.scene.globe.ellipsoid
let cartesian = viewer.scene.pickPosition(movement.position)
if (cartesian) {
let cameraPosition = cesiumManager.cesiumViewer.camera.position
let horixontalRay = cesiumManager.cesiumViewer.camera.getPickRay(movement.position)
// let horizontalDirect = horixontalRay.direction
// let verticaleRay = new Cesium.Ray(cameraPosition, horizontalDirect)
let verticalPointPosition = Cesium.IntersectionTests.raySphere(horixontalRay, this.displayGs3DTilesetList[this.curDisplayGs3DTileset].boundingSphere)
let getpoint = Cesium.Ray.getPoint(horixontalRay, verticalPointPosition.start)
}
Why getpoint is different from cartesian ?
I think that’s because [pickPosition](https://cesiumjs.org/Cesium/Build/Documentation/Scene.html?classFilter=Scene#pickPosition)
reconstructs a 3D position from the depth buffer, whereas raySphere
and getPoint
actually compute the intersection in 3D space.
How different are the results you’re getting?
When the cartesian is
x:-2394564.7475684695
y:5386067.297267893
z:2428441.0155852796
the getpoint is
x:-2394643.9191089952
y:5386294.24450341
z:2428312.319976609
I think one difference might be that for getPoint you’re computing against a boundingSphere, whereas the ellipsoid itself is not a sphere. Another issue could be is that the pick function isn’t executed synchronously with the render loop. Running this code in a postRender event will fix that if that’s the issue.
If you can put together a running Sandcastle example of this I can try to take a closer look at this discrepancy. In the mean time, you can take a look at the source yourself to get a better idea of exactly what each function is doing. Here’s pickPosition to get you started. It also might be related to this issue: