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.
  2. Dismiss Notice

Third Person Camera follow behind character

Discussion in 'Cinemachine' started by jdscogin, May 26, 2020.

  1. jdscogin

    jdscogin

    Joined:
    Oct 26, 2014
    Posts:
    88
    I would like a camera to follow behind a character. If the player turns left, the camera would stay behind. I am sure this is simple, but I can't figure it out. Using CineMachine.
     
    ManjitSBedi likes this.
  2. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    We have a few third person camera examples. Update your cinemachine version to preview version 2.6, and then import our samples.
    Check these scenes: 3rdPersonWithAim, DualTarget, and AimingRig.
     

    Attached Files:

  3. jdscogin

    jdscogin

    Joined:
    Oct 26, 2014
    Posts:
    88
    Thanks!
     
  4. Devsagi

    Devsagi

    Joined:
    Sep 28, 2019
    Posts:
    33
    Hello there,

    I have installed the update 2.6 and imported the samples. I tested the Scene 3rdPersonWithAim and AimingRig, but the camera movement there stutters a lot, especially when the frame rate varies.
    I remember the Cinemachine Free Look camera having the same problem before it got improved with the "Input Value Gain" setting recently.
    How can I achieve a similar smoothness improvement for the 3rd Person Follow mode?

    Best regards
     
  5. jdscogin

    jdscogin

    Joined:
    Oct 26, 2014
    Posts:
    88
    This worked, but now I have a problem. The character I use (mixamo) must wobble back and forth when he is walking. This causes the camera to wobble.Does not look right. I can't figure out how to keep this from happening. Can you help? See the video link.
     
  6. jdscogin

    jdscogin

    Joined:
    Oct 26, 2014
    Posts:
    88
    I found a different walk animation that works ok. It is from Macamin Ethan.
     
    gaborkb likes this.
  7. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    The third person camera does not have a built-in input control. This camera tracks the follow object's orientation to determine the aim, whereas the FreeLook camera has a built-in input control which determines aim based on input.

    If you experience stutter on the camera, then it may be because your follow target stutters.
     
  8. jdscogin

    jdscogin

    Joined:
    Oct 26, 2014
    Posts:
    88
    Yes, that is the problem. The character moves to the left and right as he walks.
     
    gaborkb likes this.
  9. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    In this case, separate the animation from the transform.
    For example, you could have an empty gameObject that tracks position and orientation based on your inputs. Then have your character with animation as a child of this empty gameObject.
     
    jdscogin likes this.
  10. jdscogin

    jdscogin

    Joined:
    Oct 26, 2014
    Posts:
    88
    Yes, I finally got that to work.
    Thanks so much.
     
    gaborkb likes this.
  11. davitsedrakian

    davitsedrakian

    Joined:
    Jun 23, 2018
    Posts:
    30
    Hey Guys! @gaborkb can i change rotation of third person camerra by X axis, to not look exactly to forward!
     
  12. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    You can do that by having an extra gameobject on your player. Rotate this extra gameobject on the X axis. Your camera should follow this extra gameobject. The vcam is going to track this extra gameobject's forward.
     
    ElXill likes this.
  13. davitsedrakian

    davitsedrakian

    Joined:
    Jun 23, 2018
    Posts:
    30
    thanks, I already done like that, I though there should be some better solution except this, that's the reason I asked here! :)
    thanks
     
  14. jsx001

    jsx001

    Joined:
    Nov 28, 2016
    Posts:
    12
    Hi All,
    I have the same problem with the wobbly camera due to the cameras follow target tracking a root motion animation from Mixamo which has the characters head move slightly from side to side as he goes forward.

    I am using a virtual camera with third-person follow, from the aim sample, which with simple anims is perfect.

    I noted the above solution about tracking another object, but I can't seem to make this work without getting really complicated player structure, colliders and rigid bodies, all of which I need to use over a network game.

    Does any know of a simple example of Mixamo 'wobble' animations with Cinemachine third person example?

    thanks
     
  15. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    Does your character have a root object that is not wobbly? You could track it offset by the height of your character.
     
    Gregoryl likes this.