Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #95
Changes:
CesiumGeoreference
to transform direction vectors between ECEF and Unity World.An easy way to test the old vs new behavior is to add two far-apart tilesets like Denver and Melbourne. Double-click on the further one and then hit "Place Origin Here". Repeat for the other tileset.
The specific mechanism by which I overrode Unity's focusing behavior is a bit hacky, so I'll explain it here briefly. So Unity provides a way to override a gameobject's apparent bounding volume - this overriden bounding volume is what gets used for Unity's built-in focusing functionality. If we simply provide a custom Unity bounding volume (converted from the root tile's ECEF bounding volume), then the camera might awkwardly get positioned below the terrain when focusing a tileset on the other side of the Earth (Unity will not understand the local "up" direction).
So we want to construct the camera focus transform ourselves, which we can do using the
SceneView
API. However, there is no clear way to get notified on the hierarchy double-click event, and there is no way to explicitly override the default focusing behavior that happens on double-click (apart from custom bounds as mentioned above). So instead what we do is the following:SceneView
wants to focus on the tileset (SceneView
will invokeOnGetFrameBounds
to request custom bounds).SceneView
.If anyone finds a more elegant way going forward absolutely feel free to throw this hack away, but it seems to work well for now!