Search Unity

ThirdPerson cam lock enemy

Discussion in 'Cinemachine' started by TheTalkingBoot, Sep 20, 2019.

  1. TheTalkingBoot

    TheTalkingBoot

    Joined:
    Nov 24, 2017
    Posts:
    36
    Hi there!

    I need some help with cinemachine to set up a Lock Target camera like in Action-Adventure games.
    I already searched on the web for some tutorial but nothing work correctly.
    My character move is done by script, no root motion.

    Here what I've already try without success. The result on the left is the closest to what I'm looking for.
     

    Attached Files:

  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Can you describe exactly the camera behaviour you want?
     
  3. TheTalkingBoot

    TheTalkingBoot

    Joined:
    Nov 24, 2017
    Posts:
    36
    I need the camera follow the player when look at a target and keep both in the field of view.
    And collide with the environement.
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Have you tried a FreeLook following and looking at a CinemachineTargetGroup that contains both the player and the target in question? You can put a CinemachineCollider on that.
     
  5. TheTalkingBoot

    TheTalkingBoot

    Joined:
    Nov 24, 2017
    Posts:
    36
    Yes, I try this. But with Group composer, the FreeLook does not reach to keep the player and the target in the field of view when the player move. And when I rotate the camera, it goes crazy.
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    This is probably because your settings are not correct. Perhaps you could put together a small test project that you can share, so we have something more concrete to talk about. Otherwise I'm just stabbing in the dark.
     
  7. TheTalkingBoot

    TheTalkingBoot

    Joined:
    Nov 24, 2017
    Posts:
    36
    Here a sample scene in Unity 2019.1.8f1.
    Don't pay attention to the CharacterController, it's not definitive.

    Hope it will help you to see what I've done wrong :)
     

    Attached Files: