Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  6. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  7. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  8. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

State Driven Camera for Over the Shoulder TPS

Discussion in 'Cinemachine' started by ViveLeCommune, Aug 3, 2018.

  1. ViveLeCommune

    ViveLeCommune

    Joined:
    May 2, 2015
    Posts:
    9
    So I'm switching my TPS game project over to the cinemachine system and experimenting with using the state driven camera with different free look cams. The issue is that I think they need to be set to worldspace orbits to work with my setup (I'm rotating the character with the camera), and with worldspace orbits the camera resets its rotation on transition to a new state.

    Is there a way to get around this without code? Or if custom scripting is necessary where's a good place to start?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,408
    Are you using the latest CM from package manager? You should be.
    The code there transfers the axis values on transition between FreeLooks with the same Follow target.
    Also be sure in your use-case to check the "Inherit Position" checkbox:

    upload_2018-8-3_11-56-0.png
     
    ViveLeCommune likes this.
  3. ViveLeCommune

    ViveLeCommune

    Joined:
    May 2, 2015
    Posts:
    9
    I'm using the latest download from the package manager.

    I thought that checking that might fix the issue but I have them checked on all my free look cameras and it hasn't fixed it. The only way I've got it to stop is by switching all my cameras' orbits binding from "worldspace" to "Simple follow with world up", but this causes problems with character control.
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,408
    Then I don't understand what's happening. The code in FreeLook does this:
    Code (CSharp):
    1.         public override void OnTransitionFromCamera(
    2.             ICinemachineCamera fromCam, Vector3 worldUp, float deltaTime)
    3.         {
    4.             base.OnTransitionFromCamera(fromCam, worldUp, deltaTime);
    5.             bool forceUpdate = false;
    6.             if (fromCam != null)
    7.             {
    8.                 CinemachineFreeLook freeLookFrom = fromCam as CinemachineFreeLook;
    9.                 if (freeLookFrom != null && freeLookFrom.Follow == Follow)
    10.                 {
    11.                     if (m_BindingMode != CinemachineTransposer.BindingMode.SimpleFollowWithWorldUp)
    12.                         m_XAxis.Value = freeLookFrom.m_XAxis.Value;
    13.                     m_YAxis.Value = freeLookFrom.m_YAxis.Value;
    14.                     forceUpdate = true;
    15.                 }
    16.             }
    17.  
    Maybe there's something weird in your controller?
    Or maybe the Follow targets aren't the same?
    Can you upload a little package that shows the problem?
     
  5. ViveLeCommune

    ViveLeCommune

    Joined:
    May 2, 2015
    Posts:
    9
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,408
    Thanks. Using CM 2.2.7 I see no problems at all on transitions. It's perfect. What version of CM are you using?
     
  7. ViveLeCommune

    ViveLeCommune

    Joined:
    May 2, 2015
    Posts:
    9
    I'm using CM 2.2.0. Sorry, I thought that was the most up to date version.

    How do I get CM 2.2.7?
     
  8. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,408
    Just open the package manager, it should prompt you to upgrade
     
  9. ViveLeCommune

    ViveLeCommune

    Joined:
    May 2, 2015
    Posts:
    9
    Do I need a newer version of Unity? I've got 2018.2.2 and the package manager says I'm up do date.
     
  10. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,408
  11. ViveLeCommune

    ViveLeCommune

    Joined:
    May 2, 2015
    Posts:
    9
    That fixed it! Thank you so much for helping me out!