Zoom in and out on a model to reveal inside details

Hi, I have played with normal camera then cinemachine for some hours, but still couldn’t figure out how to solve this problem. It surely isn’t something new because many have done it before. But I’m totally new to advanced camera controlling, so…

The case: I want to control the camera like any other anatomy app to zoom in on a human model to reveal each layer of details.
The problem: Changing camera’s FOV resulting in view distortion, while changing camera’s position is just a bad idea because the camera could go past the model.
Note: Users could import a model of their own into the app, so the camera controller must be dynamic on models’ size. (I really don’t know if this info is significant or not.)

The questions: Could FreeLook camera be used to solve this problem? And how to do that? Or other guidelines if cinemachine isn’t what I need?

Thanks!

The first thing you need to decide is exactly what you would like the camera to do. Once you have a specific behaviour in mind, then we can look at how to achieve it.

Let me see if I understand what you’re trying to do:

  • You have a many-layered model of indeterminate size
  • You want the user to be able to move the camera around in space, going right inside the model, in order to focus on details within it
  • You want the user to be able to arbitrarily pivot the camera in any direction - i.e. there is no significance to the “up” or “down” direction
  • You want the camera’s FOV to remain constant

Do I correctly understand the situation?
How will the user control the camera?

1 Like

Sorry for the late reply, I have been focused on the camera to understand it properly. Yes your understanding of my problem is correct. The user can control the camera by touch gestures: 1 finger to rotate the camera around a point, 2 fingers to pan the camera across the screen, or “zoom”. However, input methods must be dynamic because they could be changed at later stage of the project.

Btw, I’ve understanded more about the camera and realized that cinemachine doesn’t have anything to do with this. But I do appreciate any guidance on controlling the camera to “zoom” or move around and inside the model. I sitll haven’t figured out how to control the camera properly if 2 layers are too close: if I just move the camera into the model, there is a great chance that the camera will go past the 2nd layer (which is inside the 1st one) because the distance between the surfaces of the 1st and 2nd layer is to small in Unity’s unit.

Why not just have a static camera and use the gestures to move/rotate/scale the model?

I don’t know if that could be a better solution, since the content of a scene is dynamic: we don’t know how many models will be in a scene and how they are arranged. Of course I could make them children of some root gameobject. But with an undetermined number of models is it good to scale/move/rotate them instead of the camera only?

It might work. If they are all children of a root object, then you would only have to move/scale/rotate that root object. The advantage is that the units for the camera will remain constant, even when really zoomed in. The alternative would be to manage some kind of “current unit” for the camera, that is scaled along with the zoom factor. Either way is equivalent.