When you use the zoomOn() on the arcRotateCamera to fit the mesh into the camera view the height of the mesh is not taken into account.
I made an example:
Also the camera-target will be moved to 0,0,0 and the top of the box goes out of the screen.
Can someone help how to solve my problem
Well, no, obviously it isn’t. The target is set at the center mesh axes (it’s a one point, vector3 position that is the center of the mesh (not the outside shape).
Since it’s an arc rotate camera, it will always keep your target as well… a target
So, no matter which side you are looking at it, it will continue to focus on your target.
Without colliders or limits, the camera will move right through the target and look at the target from the other side. The difference you can see between the front and back look of the camera at your target, is from the camera position. If you go into negativ values, the camera will take the initial position values while facing the target and then “mirror” them. Say you’d place your camera exactly straight in front of the target before zooming, and then zoom/go through the target, the camera will still keep your target at same position and will simply show the object from the other side.
Edit: Quickly did this PG for you. Might be easier to get an understanding from there: