Optionaloptions: FitCameraOptionsOptions for fitting the camera
import { fitCamera } from '@needle-tools/engine';
// Fit the main camera to the entire scene
fitCamera();
import { fitCamera } from '@needle-tools/engine';
// Fit a specific camera to specific objects with custom options
const myCamera = ...; // your camera
const objectsToFit = [...]; // array of objects to fit
fitCamera({
camera: myCamera,
objects: objectsToFit,
fitOffset: 1,
fov: 20,
});
Fit the camera to the specified objects or the whole scene.
Adjusts the camera position and optionally the FOV to ensure all objects are visible.