Search Unity

FreeLook Orbit 2 targets, update orbit path to elliptical

Discussion in 'Cinemachine' started by pleasantPretzel, Oct 2, 2017.

  1. pleasantPretzel

    pleasantPretzel

    Joined:
    Jun 12, 2013
    Posts:
    34
    Hi! Is there an in-editor way to orbit more than one target with the CM FreeLook cam? If so, could it dynamically update the orbit path shape?

    I've attached a diagram below of a circumbinary* planet to describe my goal. *(I just learned that word today, don't let me fool you! haha) P-type would be the FreeLook Cam, two stars are the target gameobjects.

    ps-type.jpg
    This question is inspired by Zlda's BotW targeting camera. It seems to behave something like this.
    Much thanks!
     
  2. pleasantPretzel

    pleasantPretzel

    Joined:
    Jun 12, 2013
    Posts:
    34
    You know, the second after I clicked "post", I realized this is probably overkill, and my original implementation of averaging a center aim among targets is fine. Sorry! :oops:
     
  3. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    I know you retracted it, but it's an interesting question :)

    Orbiting the average position of multiple targets: use a CinemachineTragetGroup, and set your FreeLook to lookAt and orbit that. Add as many targets to the group as you like, with weights to indicate your level of interest. That should work out of the box.

    For dynamically modifying the orbit shape: there is no script-free way to do that out of the box, but a little script to dynamically modify the orbits in the FreeLook would be quite easy to implement. Just add a custom behaviour to the FreeLook gameObject, monitor the targets and the camera position in relation to them, and dynamically adjust the FreeLook's m_Orbits field.
     
    Kerber996 likes this.