Skip to content

Commit

Permalink
#5455: MapPreview should focus on the scene bounds origin, not the wo…
Browse files Browse the repository at this point in the history
…rld origin. Many prefabs have been saved with their elements placed off-center.
  • Loading branch information
codereader committed Jan 21, 2021
1 parent a0300c9 commit 8aae7f8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions radiant/ui/common/MapPreview.cpp
Expand Up @@ -29,9 +29,10 @@ void MapPreview::setRootNode(const scene::IMapRootNodePtr& root)
resetModelRotation();

// Calculate camera distance so map is appropriately zoomed
double distance = getScene()->root()->worldAABB().getRadius() * 2.0f;
auto sceneBounds = getSceneBounds();
auto distance = sceneBounds.getRadius() * 2.0f;

setViewOrigin(Vector3(1, 1, 1) * distance);
setViewOrigin(sceneBounds.getOrigin() + Vector3(1, 1, 1) * distance);
setViewAngles(Vector3(34, 135, 0));
}
}
Expand Down

0 comments on commit 8aae7f8

Please sign in to comment.