Player should not be able to move the camera inside certain colliders. For example, accidentally looking through the terrain.
You'll probably want to create a new script attached to the root player object that references the player camera GameObject (this is a child of Player/Yaw/Pitch transforms).
Once you have a reference to the player camera, you can raycast in it's direction, and if we hit a collider we move the camera closer to the player. Of course, the camera should return to some default distance given no colliders. We also want to allow some low-priority colliders to be ignored (see: trees, small rocks, ect.), so use layers to select the colliders that are considered in the raycast.
You'll probably want to create a new script attached to the root player object that references the player camera GameObject (this is a child of Player/Yaw/Pitch transforms).
Once you have a reference to the player camera, you can raycast in it's direction, and if we hit a collider we move the camera closer to the player. Of course, the camera should return to some default distance given no colliders. We also want to allow some low-priority colliders to be ignored (see: trees, small rocks, ect.), so use layers to select the colliders that are considered in the raycast.