Cannot create RectangularSensor

Hello,
I am using Cesium for a university project. Everything is working perfectly, however, I wanted to implement sensor cones. I saw that you have functionality for this in Cesium ion so I created an account and an access key. Also I have added the access key in my project using Cesium.Ion.defaultAccessToken. When I try to create an instance of RectangularSensor I get the following exception: “Uncaught TypeError: Cesium.RectangularSensor is not a constructor”. Could you please tell me what I have to do in order to make it work. Thank you in advance!

Krasimir

I didn’t find in the documentation what you want to use. You can try using EllipsoidGraphics with Cesium.EllipsoidGraphics.ConstructorOptions

I saw this here: RectangularSensor - Cesium Documentation . I need to be able to show the intersection with the world terrain and what parts of the vision cone are not visible.

This is most likely a commercial product

Yes, that is possible. I just wanted to evaluate it and do a demonstration. Is there any way I can use it?

I think no

1 Like

There is such an idea. I made a figure from that documentation.
var redSphere = viewer.entities.add({
name: “Red sphere with black outline”,
position: Cesium.Cartesian3.fromDegrees(-107.0, 40.0, 300000.0),
ellipsoid: {
radii: new Cesium.Cartesian3(300000.0, 300000.0, 300000.0),
innerRadii: new Cesium.Cartesian3(1.0, 1.0, 1.0),
material: Cesium.Color.RED.withAlpha(0.5),
outline: true,
stackPartitions: 80,
slicePartitions: 80,
subdivisions: 32,
minimumClock: Cesium.Math.toRadians(100),
maximumClock: Cesium.Math.toRadians(180),
maximumCone: Cesium.Math.toRadians(90.0),
minimumCone: Cesium.Math.toRadians(40.0),
},
});

You just have to use Cesium.IntersectionTests.rayEllipsoid to find the intersection points. Then collect all the points into an array and draw a line along them. This will show you where the conical shape intersects.

2 Likes

Thank you very much! I will try it out.

Hey ‘Cesium.IntersectionTests.rayEllipsoid to find the intersection points’ Would you be able to help me out with this, for example, if there were a few points on the map inside the view cone, and from a user point can I change this, does the redSphere interact with this to find the intersection points and can then display this? Thank you :slight_smile: