Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Setting direction for Freelook camera.

Discussion in 'Cinemachine' started by Redux, Jan 2, 2020.

  1. Redux

    Redux

    Joined:
    Nov 10, 2011
    Posts:
    146
    What if you wanted to set a specific vector for the freelook camera to orient to as forward? How is this accomplished? It doesn't need to happen all the time but I'd like to be able to tell it where to look exactly and move it there during a lerp from wherever it was before.
     
  2. awiebe

    awiebe

    Joined:
    Oct 16, 2018
    Posts:
    14
    You would think it should be as easy as telling cinemachine to take the direction from the camera, but it doesn't seem to be. I've been having trouble getting it to behave too. Related discussion here.
    https://forum.unity.com/threads/how...amera-without-it-lerping.507638/#post-5332596

    It seems the OP of that post found a work around, but I haven't yet figured out what it is. I posted my code for teleporting my camera but as soon as I turn the VCam back on it screws up the lok direction, even though the look at target is in the exact same position relative to old look at target.
     
  3. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    Hmmm... this is a little tricky. It's a question of finding the right values to put into the X and Y axes of the freelook, which will depend on the orbits and the binding mode.

    Currently there is a private API to do something like this, which is called from OnTransitionFromCamera() when InheritPosition is enabled. We could look into making a public API for this feature.

    You mentioned lerp. Does that mean that you're transitioning from another vcam and want the incoming freelook to have axis values to best match its position? In that case, InheritPosition should do the job for you.

    upload_2020-1-6_13-44-11.png

    Otherwise, you could try making a temporary vcam with DoNothing everywhere, placing it appropriately, and calling freeLook.OnTransitionFromCamera manually with the temp vcam as the fromCamera. Make sure the freeLook has InheritPosition checked. That will make freeLook choose the best axis values to match fromCamera's position.

    Let me know if that works for you.
     
  4. Redux

    Redux

    Joined:
    Nov 10, 2011
    Posts:
    146
    Thank you