hi
i am trying to determine if the entity is inside or outside of the camera view
and i saw an example with czml data and datasource but i dont use them in my case
is there any way to determine it or it is a bug ?
the boundingsphere i pass here is
const sphere = new BoundingSphere(cartesian3);
the problem i am having there is when i call it in a function ( Reactive )
its always sends -1 Outside
but only if i use it directly only on first render its sends 1
then if i update position and the entity still in the view its returning -1
here is a code snippet of what i try
try {
if (viewer) {
const { camera, scene } = viewer;
scene.render();
if (!scene.renderError) {
console.log('Scene render incomplete');
}
const { frustum } = camera;
const cullingVolume = frustum?.computeCullingVolume(camera.positionWC, camera.directionWC, camera.upWC);
if (!cullingVolume) {
console.log('Culling volume not available');
return false;
}
const visibility = cullingVolume.computeVisibility(sphere);
console.log('Visibility:', visibility);
return visibility === Intersect.INSIDE;
}
console.log('Viewer not available');
return false;
} catch (e) {
console.log('Error:', e);
return false;
}
};