Fighting game camera that zooms out when the fighters are far from eachother

Hey folks, im pretty sure many of you have played teken… or even smash bros, and noticed that unlike 2D fighting games… the camera actualy zooms out when the two players starts distantiating from eachother

any idea of how to reproduce this in unity?

i mean… i tough about having a camera attached to one object (player1), but with a comand to look at the other object (player2) that way… even if they split apart very far, they will still be both visible since the camera is attached to one right in front of him… but looking at the other one faaar beyond

the problem with this is…

the camera actualy rotates to look to the other player when he goes too far… and since the game is 2.5 D… is not cool to have a rotating camera =/

ideas??

The camera should be looking at a point which is halfway between the two fighters? Just calculate that point and move the camera along with it. Then have it change the viewport angle/size depending on the distance between the fighters.

A screenshot would be handy so we can see your chosen perspective.

Use

to get the length between the two characters and put if else statement in Update() function and move the camera along with the length.

Using LateUpdate will make the camera movement a bit more predictable.

You’re also going to want to transform the distance by some factor of the aspect ratio, otherwise it won’t work at all distances.

guys thanks for the tips!.. i got it working finaly (4 days of attemptive… but now its great) i’ll be posting some screens … and even a webdemo soon if someone wants to check out

thnkz again, see ya! o/