How to keep 2 objects in view at all time by scaling the field of view? (or z&y axis)

前端 未结 5 436
我在风中等你
我在风中等你 2020-12-29 00:11

I\'m making a little arcade shooter for 2 players, and need to have the screen focused on 2 players, I got the camera moving in the center of the players in the X axis, but

5条回答
  •  滥情空心
    2020-12-29 01:06

    just to add on @nokola's answer, (I cannot comment yet..) it seemed like his camera can only go above the objects, so instead of doing:

    _camera.transform.position = bounds.center + Vector3.up * resultDistance;
    

    you may do:

    _camera.transform.position = bounds.center + -_camera.transform.forward * resultDistance;
    

    now it should work for any rotation camera has. (for me it did atleast)

提交回复
热议问题