My users are able to add a 3DTileset by url, I want to be able to zoom to the new tileset. I can’t find a way to get latitude/longitude for a tile or the bounds defined by the tileset.
Here’s how it’s done when you double-click a tileset in the Editor. You should be able to repurpose this code to move a Pawn at runtime.
Thanks for the reply, however this is for Unreal, my question is specific to Unity. I believe this cannot be ported to Unity? ( I tagged my post as Cesium for Unity, should I also mention this in the title?)
I’ve now made a hacky version that parses the tileset.json file. The tilesets I’m currently testing with all come from disk and have a region bounding volume. This approach however is not very generic so it would be nice if there was a way to get the bounds of a Cesium3DTileset component.
Oops, sorry about that, I thought I was reading a message in the Unreal forum for some reason! No need to mention it in the title or anything.
The equivalent code for Unity is here:
But because it’s in C++, it’s not easy to use this outside of the Cesium for Unity plugin itself.
So the short version is that there’s no really a way to do this in Unity, currently. But one could be added, and we’d welcome a pull request to that effect. What I’d suggest is to take that FocusTileset method, and refactor it to separate the bits that get a suitable view from the parts that actually move the Editor camera. The “get the view” part will still need to be implemented in C++, but after the refactoring it will be usable at runtime and from C#.
Thanks for the clear answer.
I’ll have a look later to see if I can add this feature. I’ll be sure to create a PR for it then. Thanks for the pointer on where to get started for this.
One thing I’ve seen mentioned by a few others here and there is that currently a lot of the api is dependent on there being an obvious (main) camera. However in certain XR applications having a obvious main camera is not possible. In my case our application has multiple camera’s in the scene. Adding a extra single main camera can be a workaround however this creates more complexity and requires sketchy workarounds to not cause rendering overhead from this new camera. Overall it would be nice if api’s exposed a bit more of the low level code like setting view frustum for loading, or getting the bounds of a tile.
I’m not sure if this is the correct place for this feedback. Besides this thanks for the help and overall nice plugin!
That’s for the feedback. Better camera support is definitely on the list. The issue to track it is here: