I'm trying to create a 3rd person camera that zooms according to 2 objects. Basically the camera will focus the one player, but when another player goes out of view to zoom out to show more of the view. I tried a simple thing such as:
The trouble with this is when player2 returns to the view it zooms in which puts player2 out of view, then zooms out again and so on. This makes the zoom jerk in and out continuously while the player2 is at the edge of the view.
What's the best way to achieve the effect I'm looking for?
If Not EntityInView(player2, camera) zoom = zoom - 0.05 else zoom = zoom + 0.05 EndIf If zoom < 0.2 then zoom = 0.2 If zoom > 1 then zoom = 1
The trouble with this is when player2 returns to the view it zooms in which puts player2 out of view, then zooms out again and so on. This makes the zoom jerk in and out continuously while the player2 is at the edge of the view.
What's the best way to achieve the effect I'm looking for?