Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Cinemachine camera on solar system ( planet rotation )

Discussion in 'Cinemachine' started by Cirlu, Feb 19, 2023.

  1. Cirlu

    Cirlu

    Joined:
    Oct 3, 2020
    Posts:
    9
    Hey there ! :)

    Maybe some people already experienced that, here my question :

    I have a solar system, with a player on a planet, when the planet is not orbiting around the sun, i don't have any issue with Cinemachine freelook camera in orbital mod.

    No_rotating.gif


    Then when i active the orbital rotation of my planet, the cinemachine camera is like affected by the planet rotation movement

    Rotating.gif

    And i already removed all damping

    CC.jpg

    It's like the X axis value is affected by the simple follow with world up, but since i setup a player that can go around the planet, i need the keep this setup like this.
    I tried as well Cinemachine 3.0 in a different project just to see, i have the same result. ( I love the new cinemachine simplicity btw ! ).

    There is a way to "fix"that ? by an extention script or if i can edit the cinemachine scripts ? but i just don't know where .

    Thank ! any solution will save me.

    PS: solved => i finnaly decide to change the Binding Mode to Lock to target with world up => then i needed to adapt my player rotation movement script
     

    Attached Files:

    Last edited: Feb 20, 2023
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,552
    Changing the Binding Mode is indeed a good way. SimpleFollowWithWorldUp is a lazy follow algorithm: it tries to maintain a specified distance from the target, but ignores the angle of view. If the target is moving in space, the camera will follow to maintain the distance, as if pulled by a string - so the angle of view will depend on the direction of motion.

    If you wanted to keep the lazy follow behaviour, it might be possible to treat the planet's motion as a player warp, and call CinemachineCore.OnTargetObjectWarped every frame the player moves as a result of planetary motion. That might work. But your solution is better, if you're happy with the new camera behaviour.