frame method

void frame(
  1. Aabb3 bounds, {
  2. double margin = 1.5,
})

Frames bounds by centering the target and dollying to fit its bounding sphere, with margin padding.

Implementation

// TODO(camera): make framing field-of-view aware (needs the CameraComponent
// projection) so it fills the view exactly, like PerspectiveCamera.framing.
void frame(Aabb3 bounds, {double margin = 1.5}) {
  _targetGoal = bounds.center;
  final radius = math.max((bounds.max - bounds.min).length * 0.5, 1e-4);
  _distanceGoal = (radius * 2 * margin).clamp(minDistance, maxDistance);
}