You could shoot a ray from the player to the camera position and when the ray hits an object, the camera temporarily moves right below that position of the nearest object. So it would zoom in in the same direction as before, but with no obstacles in the way. When there is free sight again, the camera moves away to the old distance. You could animate that smoothly instead of jumping
True, but I imagine in a place with many trees that would still cause the camera to go up and down constantly. But it might be worth trying tho. Will also check how other games with similar camera controll are dealing with it
@@Zuzelo Yeah that could cause some annoying camera jumping. Another idea that came up: In case the camera just got newly covered, the camera could move opposite to the direction the obstacle moved into the view (which should be the same angle as the player moves?), but only for smaller corrections like for leaves and branches. When the camera correction gets too strong, the camera jumps close to the player like in the previous idea (when big rocks block or you are inside a cave or something)
@@glumpfi hm, I wonder how that would work in a cave or house. Having some smart algorithm for moving the camera could indeed help, but might be tricky get it to work :D
@@Zuzelo maybe you could modify the tree model and put a big transparent shape on all the leaf volume, so the camera will move depending on this shape instead of all the small leafs
Yeah, not rendering the tree could be an option, but I am not yet sure how to do that in unity (especially if I want to render only a part of the tree)
@@Zuzelo hmm another possibility would be auto zoom and to prevent going up and down in forest maybe make an x radius for something above you and If there is a tree then it will go down and only when nothing is abowe in that radius it will come up