diff --git a/src/components/Avatar/Avatar.component.tsx b/src/components/Avatar/Avatar.component.tsx index 341d0fe..43d6024 100644 --- a/src/components/Avatar/Avatar.component.tsx +++ b/src/components/Avatar/Avatar.component.tsx @@ -313,6 +313,20 @@ const Avatar: FC = ({ useEffect(() => triggerCallback(onLoading), [modelSrc, animationSrc, onLoading]); const enablePostProcessing = Boolean(effects?.ambientOcclusion || effects?.bloom || effects?.vignette); + const cameraControlsMinDistance = useMemo(() => { + if (controlsMinDistance) { + return controlsMinDistance; + } + + return halfBody ? CAMERA.CONTROLS.HALF_BODY.MIN_DISTANCE : CAMERA.CONTROLS.FULL_BODY.MIN_DISTANCE; + }, [controlsMinDistance, halfBody]); + const cameraControlsMsxDistance = useMemo(() => { + if (controlsMaxDistance) { + return controlsMaxDistance; + } + + return halfBody ? CAMERA.CONTROLS.HALF_BODY.MAX_DISTANCE : CAMERA.CONTROLS.FULL_BODY.MAX_DISTANCE; + }, [controlsMaxDistance, halfBody]); return ( = ({ cameraTarget={cameraTarget} cameraInitialDistance={cameraInitialDistance} cameraZoomTarget={cameraZoomTarget} - controlsMinDistance={controlsMinDistance} - controlsMaxDistance={controlsMaxDistance} + controlsMinDistance={cameraControlsMinDistance} + controlsMaxDistance={cameraControlsMsxDistance} updateCameraTargetOnZoom={!halfBody} /> {AvatarModel}