Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Camera rotate above target instead of rotate around target when player move cross target

Discussion in 'Cinemachine' started by baranovoblmivan936, Feb 8, 2023.

  1. baranovoblmivan936

    baranovoblmivan936

    Joined:
    Jan 19, 2023
    Posts:
    5
    I am making a lock camera, right cylinder is player, red sphere is target.
    It's possible that player move across target in actual gameplay.

    Link to video in case it can't auto play:gfycat.com/uncommonmediocrefreshwatereel


    But when they overlap, camera rotate above target(red path), that's not what I want, I want camera rotate around target(green path).

    How can I make this happend?

    Here's virtual camera settings:


    Project file in attachment.
     

    Attached Files:

  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    6,882
    When you say "overlap", do you mean that they are on the same spot, like this?

    upload_2023-2-8_8-34-32.png
     
  3. baranovoblmivan936

    baranovoblmivan936

    Joined:
    Jan 19, 2023
    Posts:
    5
    Yes, player and target are almost at same position, that's possible in actual gameplay, player cast a skill and move cross target, they will overlap for 0.5s.
    But this will make camera above target and rotate around 90 degrees, I hope its vertical angle limited below 45 degrees, and camera won't move above target, instead, move around target, just like a circle.
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    6,882
    With this setup, there is nothing out of the box to limit the camera movement in the way you want. The actual camera path is an emergent property of this combination of behaviours: you're asking to have the LookAt target be at one spot on the screen while looking "through" the Follow target placed at another spot on the screen. The control that you can exert is to adjust the screen positions. Putting the LookAt target very low on the screen does prevent the camera from going high up.

    To control the camera placement more fully, you might have to investigate other options. One possibility is to use a TargetGroup with a Composer/Transposer combination in the vcam.