Search Unity

Discussion Cinemachine Settings to frame objects of different width and height

Discussion in 'Cinemachine' started by sameergb25, Aug 24, 2022.

  1. sameergb25

    sameergb25

    Joined:
    Dec 18, 2020
    Posts:
    1
    Hey guys,
    I am trying to center player characters both horizontally and vertically on a 9:16 resolution. A player character is a pet model that is procedurally generated using different augment models (head, body, mane, tail, wings, eyes, etc). I want to fit these modular pets on the screen so that no augment (tail, ear, antennae, etc) gets out of the screen while maintaining a dynamic zoom such that smaller pets are zoomed in and larger pets are zoomed out. Each pet belongs to a certain stage. So, I have tried multiple techniques to generalize camera settings for a specific stage including using a group composer and assigning weights to the head and body mesh centers with a scriptable object containing settings for group framing size, min and max FOV for each pet stage. The stored settings work well for most pets per stage but some of the pets are of seahorse types so they get horizontally off-centered and some pets have a larger body-to-head ratio so they get vertically off-centered. Also, some pets have a jump animation so they go out of the screen in the middle of the animation. I can't afford to have camera settings per pet because of pet modularity. The total combinations can go in millions. I have been stuck with this problem for days now and at this point, I can't think of any generic solution for this. I have been finding for a solution online as this looks like a common problem because a lot of games showcase players' characters in the main menu. Any help or leads regarding this issue are appreciated. Thanks in advance.