I used a camera following unit trigger to create a 3rd person following view. The problem is when the unit is stand right in front of something such as a hill, then the camera automatically zoom out. The result is the view of the unit is blocked by the hill, which is not very good as the player can't see what is happening to the unit.
How to solve this? For example, is it possible to have the camera zoom in automatically instead of zoom out during the above situation?
You can raytrace from the camera target to the camera viewpoint, and check if you hit the ground before you reach your camera distance.
You can do the same, looking for units instead. Here you can check the unit's distance to the ray, compared to their radius and a hight you will have to hardcode.
It's not the simplest solution, but I think it is the only way forth.
I used a camera following unit trigger to create a 3rd person following view. The problem is when the unit is stand right in front of something such as a hill, then the camera automatically zoom out. The result is the view of the unit is blocked by the hill, which is not very good as the player can't see what is happening to the unit.
How to solve this? For example, is it possible to have the camera zoom in automatically instead of zoom out during the above situation?
You can raytrace from the camera target to the camera viewpoint, and check if you hit the ground before you reach your camera distance.
You can do the same, looking for units instead. Here you can check the unit's distance to the ray, compared to their radius and a hight you will have to hardcode.
It's not the simplest solution, but I think it is the only way forth.
Thanks. Let me see if I can make it to work....