Open arbertrary opened 2 weeks ago
If there is no root tile returned by this->_pTileset->getRootTile()
this currently returns the Zerovector without warning which results in obviously incorrect coordinates.
I'm not sure what causes a tileset to not have a root tile but it seems to be the case for some tilesets.
ACesium3DTileset::OnFocusEditorViewportOnThis()
also simply returns if it encounters a nonexisting root tile so I'm not sure how to best handle this here 🤔
Thanks for the PR @arbertrary!
The root tile is part of the tileset.json, which is download when the tileset is first loaded. Until that download / parse completes, we don't know anything about the tileset, not even where it's located.
There's nothing for it other than to give the function a way to return "I don't know yet" as the answer.
I have added a warning and a boolean out value to the function so that this gets propagated and can be checked in blueprints.
Unfortunately this wasn't actually the problem. For some tilesets the function returns 0,0,0 even if the root tile is available. The !prootTile
condition was actually never entered.
Tilesets where that was the case:
Tilesets where the code does work for me as expected are for example
Unfortunately this wasn't actually the problem. For some tilesets the function returns 0,0,0 even if the root tile is available. The
!prootTile
condition was actually never entered.
Checking whether the initial load of the tileset is complete by confirming that LoadProgress
equals 100.0 before calling getApproximateLocation
doesn't change this as well.
As discussed in the following Cesium community forum thread, there is no API-level support to get the world location of a tileset during runtime from UE blueprints.
https://community.cesium.com/t/get-coordinates-of-cesium3dtileset-spawned-at-unknown-location/33087/4
As suggested by @kring I had a look at the
ACesium3DTileset::OnFocusEditorViewportOnThis()
function. With this pull request I added two functions that return an approximate location (Unreal and ECEF) of the tileset calculated using the rootTile.Disclaimer: