Hi
I will calculate position of intersection of a ray with earth terrain . i use this command but it return undefined.
‘’’
var terrainIntersect = viewer.scene.globe.pick(ray, viewer.scene);
‘’’
Hi
I will calculate position of intersection of a ray with earth terrain . i use this command but it return undefined.
‘’’
var terrainIntersect = viewer.scene.globe.pick(ray, viewer.scene);
‘’’
Hi @mohamad,
I would start by ensuring that your ray
object is in world coordinates! The pick
documentation specifies that the ray
object must be in world coordinates.
https://cesium.com/learn/cesiumjs/ref-doc/Globe.html#pick
Can you please confirm this?
Best,
Sam
my problem resolved by using in time interval .
var tilesToRender = viewer.scene.globe._surface._tilesToRender;
setInterval(function() {
if(tilesToRender.length !== 0){
var terrainIntersect = viewer.scene.globe.pick(ray, viewer.scene);
}
}, 200);
Thank you for sharing this with the community! I am glad to hear that your issue has been resolved.
Best,
Sam
… but note that variables that involve an _
underscore in their name (like _surface
and _tilesToRender
) are considered to be private variables, and this code might no longer work in a future version…