Dear all,
I am trying to intersect a ray with the terrain in order to obtain the coordinates of the intersection point.
While I do know that there is viewer.globe.pick to do this, within this function only the currently rendered terrain is used but I am in the need to intersect the ray with the most detailed terrain.
I had a look at the source code and saw, that there is an additional function located within Scene.js called pickFromRayMostDetailed which, based on the description, should exactly do what I need.
Here you find a small example on how I use this function (I am using Cesium 1.66):
cam_to_pnt_ray = new Cesium.Ray(viewer.scene.camera.position, viewer.scene.camera.direction)
var promise = viewer.scene.pickFromRayMostDetailed(cam_to_pnt_ray)
Cesium.when(promise, function(pick_pos) {
cam_pos_src.entities.add({
position: pick_pos.position,
id: “intersect_point”,
point : {
pixelSize : 10,
color : Cesium.Color.BLUE,
outlineColor : Cesium.Color.WHITE,
outlineWidth : 2,
}
});
});
In order to visualise the intersection point I add the picked position as an point entity to the scene. As it seems, the intersection point is not calculated based on the most detailed terrain as I do get the same result when I use viewer.globe.pick.
Do i misunderstand something with the functionality of “pickFromRayMostDetailed”?
Thank you for your help
Flu Tschi