Having an issue with EllipsoidalOccluder.isPointVisible

I am trying to use EllipsoidalOccluder to determine if a point is below the horizon. My code always returns true (visible) and I am not sure what I am doing wrong. I suspect that it has to do with different coordinate systems?

Here is my code:

var cameraPosition = scene.getCamera().position;

var occluderEllipsoid = Cesium.Ellipsoid.UNIT_SPHERE;

var occluder = new Cesium.EllipsoidalOccluder(occluderEllipsoid, cameraPosition);

var testPoint = Cesium.Cartographic.fromDegrees(-117.16, 32.71, 150.0);

var visible = occluder.isPointVisible(testPoint);

console.log(visible);

Thank you in advance.

Steve

Hey Steve,

The testPoint needs to be a Cartesian3 in the ellipsoid-centered frame, not a Cartographic. You can convert a Cartographic to an ellipsoid-centered Cartesian3 with code like this:

var testPointCartesian = occluderEllipsoid.cartographicToCartesian(testPoint);

Depending on what you’re doing, you may also want to use the WGS84 ellipsoid instead of a unit sphere.

var occluderEllipsoid = Cesium.Ellipsoid.WGS84;

Kevin

Wow. Less than 5 mins response time! That was it.
Thank you!

Steve