In the CesiumMetadata scene, as shown in the image, I can select buildings to obtain their information. Apart from retrieving information, I would like to implement the functionality to click-select, highlight, and hide individual 3D tiles models. Is this achievable? Because in Unity’s Hierarchy panel, these models do not exist as separate entities.
Hi @jh007,
Because in Unity’s Hierarchy panel, these models do not exist as separate entities.
Right, they’re batched together. If each building were a separate model, rendering the scene would be extremely inefficient.
I would like to implement the functionality to click-select, highlight, and hide individual 3D tiles models. Is this achievable?
Unfortunately, it’s not currently possible in Cesium for Unity. Cesium for Unreal has a metadata styling system that can be used to control appearance on a per-feature basis, including hiding features entirely, but this hasn’t been brought over to Unity yet. One of the reasons for this is that it doesn’t appear to be possible to programmatically generate materials in Unity the way we do in Unreal, so we need to come up with some kind of workaround.
Probably the closest you could get today is to hide buildings by drawing a polygon around them:
Thank you for your answer. I still have a question about the CesiumFlyToController script. Currently, the implemented flight involves the camera flying to a certain position and setting the rotation of the X and Y axes. However, I want to focus on a specific latitude and longitude. That is, when flying over, the object at the focused latitude and longitude is exactly in the center of the screen, and the distance from the camera is set as a parameter: dis. How can this be implemented? look forward to your answer
!
In the future, it’s probably best to start a new thread when you’re asking a new question.
There’s nothing built-in to do what you describe, but you can implement it yourself. But first you need to be clear about exactly where you want the camera to look at your target from. If you really don’t care about that, the easiest thing by far is to have the camera be directly above the target and looking straight down. To do that, call FlyToLocationLongitudeLatitudeHeight
with the exact longitude and latitude of your target, with a height of the target’s height plus dis
, and with a pitchAtDestination
of -90 degrees (actually -89.999 might be safer).Set the yawAtDestination
to whatever you like (0.0 is fine).
Hi, May I know if there are any other solutions around this currently? I would also like to highlight the building being selected by the user.
Hi @Wong, sorry, there is still no built-in way to highlight a building in Cesium for Unity.
Hi Kevin, thank you for the reply. Will it be supported in the future or there are no plans?
It is something we want to support in the future, but we don’t currently have a specific timeline for it.