Remove clipping CesiumPolygonRasterOverlay added during runtime

I was able to add clipping zones to my Cesium3DTiles during runtime using the blueprint suggestion by @janine in this comment and it works great. I am working with/interested in InvertSelection = true

However, I would also like to be able to remove both the CesiumCartographicPolygon from the world again as well as the CesiumPolygonRasterOverlay from the Cesium3Dtiles actor during runtime. I’m currently not sure how to best approach this.

  • Destroying the CesiumCartographicPolygon actor and refreshing the 3Dtiles crashes unreal (understandable because the CesiumPolygonRasterOverlay still exists and probably references the polygon)
  • setting the CesiumPolygonRasterOverlay Polygons field to an empty array and then calling Refresh Tileset works (sometimes?) if InvertSelection=false but otherwise the entire tileset stays invisible
  • calling Get Component by Class to get the CesiumPolygonRasterOverlay, destroying it and calling Refresh Tileset also does not restore the full Tileset.
  • Destroying the CesiumPolygonRasterOverlay Component and only then destroying the CesiumCartographicPolygon actor also crashes Unreal

It seems like there’s always something that remains from this combination and for some reason the 3dtileset doesn’t refresh to its original form.

Edit: I’m working with my own 3DTiles data that’s included locally as file:///... URL

Hi @arbertrary,

I would expect calling RemoveFromTileset on the CesiumPolygonRasterOverlay and then destroying it should do the trick.

I’d expect simply destroying the component to work as well, but the details of how exactly you’re doing that might matter. Can you share your code?

Hi, thanks for the reply. I’m using UE5.3.2 btw and the Cesium plugin through the marketplace.

This is the blueprint graph that I’m currently using to remove both the cartographic polygon as well as the overlay. The delay seems to be necessary as otherwise Unreal crashes. The actor that triggers the “Event Destroyed” is the clipping box that you can see in the video below.

This is resulting in the following behaviour:

The first placed clipping box/rectangle can be removed almost correctly although it seems to exhibit a similar error as @Dmc-1234 is encountering in this thread.

Afterwards, however, the tileset doesn’t reset to its original form again.

Thanks for the details @arbertrary. I don’t know what’s going on there, but I’ve added it to our short list of user-reported issues for deeper investigation. We’ll report back here soon with what we find out.

Thanks @Kevin_Ring :slight_smile:

I’ve dug into it a bit more. and it seems like the Remove from Tileset blueprint node isn’t working as I expected it to.

I expected the node to reset the component, i.e. clear the Polygons array and also reset for example Invert Selection to the default value. Also (unrelated to Cesium) it doesn’t seem to be that easy to destroy a component. This caused my blueprint code to add additional components each time I’m spawning my clipping box.

Here is a video that shows what happens if I use the blueprint I posted above to remove the clipping overlay. As you can see the Polygons array is not being reset to an empty array.

I have now found a solution for both my initial removal problem and the strange flickering/missing of parts of the Cesium3DTileset after removal of the Clipping Polygon.

  1. I am not adding the CesiumPolygonRasterOverlay Component during runtime anymore. I have added this component to the persistent Tileset(s) in the Level. During runtime I’m just adding/removing the Cartographic Polygon actor to the Polygons array
  2. On Event Destroyed I’m now calling RemoveFromTileset, then clearing the Polygons array and I also have to set Invert Selection to false.
  3. Afterwards I can call Refresh Tileset which solves the flickering issue.

Edit: Ok, point 1. isn’t necessary if the blueprint to add the CesiumPolygonRasterOverlay component is set up e.g. like in the post by @Riwa_Unreal here i.e. checking if the component already exists.