My camera wont stay above the ground I have in my scene. How to fix?

My camera is a child of an object that rotates. The object it placed at a point above ground and the rotation is controlled by the mouse dragging across the screen. The ground is a plane I believe. I want the camera to just not go below the ground. I have added colliders to the camera itself. Any tips or suggestions of what I could do would be nice.

Assuming you’re trying to get the camera to follow the object:

Personally, I would remove the camera from being a child object so that its translation isn’t relative to the rotating object.

Then, make a script that performs the following actions every fixed update:

  1. Gets the position of the rotating object.
  2. Calculate the position you want the camera to be in using the objects world position.
  3. Then, either just set the cameras position to the calculated position. Or, if you’re feeling fancy, you can use Lerp to make the camera ‘soft follow’ the object by only moving a fraction of the distance towards it’s desired location each update. Have done this, looks real professional for such a small script.