A viewshed shows the visible and obstructed areas from an observer's vantage point. This sample demonstrates how to attach a viewshed to a moving GeoElement.
Once the scene is done loading, click on a location for the tank to drive to. It will automatically turn and drive straight towards the clicked point. The viewshed will automatically move and rotate with the tank.
How it works
To attach a viewshed to an AGSGeoElement:
- Create an AGSGraphic and add it to an AGSGraphicsOverlay.
- Use an AGSSimpleRenderer in the AGSGraphicsOverlay which has a heading expression set. This way you can relate the viewshed's heading to the AGSGeoElement's heading.
- Create an AGSGeoElementViewshed with the graphic, heading/pitch offsets, and min/max distance.
- To offset the viewshed's observer location from the center of the graphic, set viewshed.offsetX, etc.