Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Question How to use Cinemachine Camera Offset

Discussion in 'Cinemachine' started by Samebeef, Nov 26, 2020.

  1. Samebeef

    Samebeef

    Joined:
    Mar 5, 2020
    Posts:
    3
    Hi! I'm trying to do a third person shooter camera, with character more to the left, using the Cinemachine Free Look and Camera Offset extension. But apparently the offset extension isn't being considered in the Collider extension, so it's like the camera offset is always (0, 0, 0). How to solve that?????
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,745
    FreeLook is not the best option for the 3rdPerson shooter. Use a vcam with 3rdPersonFollow instead. See the AimingRig sample scene for an example of how to do that.
     
    MLipscomb and Warrior9300 like this.
  3. unity_KpeGWh7GPxijVg

    unity_KpeGWh7GPxijVg

    Joined:
    Dec 25, 2020
    Posts:
    2
    I'm in need of help of toggling from a left and right cam in third person. Any help through code is appreciated.
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,745
    If you're using the ThirdPersonFollow Body component, then you can do something like this:
    Code (CSharp):
    1. vcam.GetCinemachineComponent<Cinemachine3rdPersonFollow>().CameraSide = isLeftSide ? 0 : 1;
    You can also smoothly lerp the value between 0 and 1 if you prefer.
     
  5. jsx001

    jsx001

    Joined:
    Nov 28, 2016
    Posts:
    12
    Really looking to find a way to do the 3rd person strafe such as Fortnite/Pugb/PWZ, its the first things the kids at the club want to do.

    FreeLook is the closest we can do, but the collider extension doesn't work.

    The 3rd Person with Aim mode (as suggested), doesn't use the 3rdPersonFollow, it uses framing transposer, which means the character walks back on the opposite side.

    The 3rdPersonFollow comes close, but left/right and mouse are not the same.

    I guess there is a combination in the million and one buttons and sliders, but it would be great if there was something a little more straightforward.

    any guidance or examples would be really appreciated.
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,745
    See the AimingRig sample, which uses the 3rdPersonFollow. Can you describe what you would need to be different about this camera/rig?
     
  7. jsx001

    jsx001

    Joined:
    Nov 28, 2016
    Posts:
    12
    Hi Gregory,
    Thanks for getting back.
    I think I have solved this, but here is what I followed and discovered, and would be interested if you agree or advise otherwise.

    I have downloaded a fresh copy of the AimingRig from CM2.7.3.
    The sample (which only animates forwards and backwards) is smooth in the y motion as the player moves forward.

    However, If you replace your Jog animation with the Mixamo riffle pack run forward animation. (even with a new avatar/model to fit).

    the Camera moves up/down as the player moves forward, this is because the animation has some small up/down movement in to and it is very distracting.
    For a 3rd person shooter, you would want to take Y the damping down from 0.5 to 0, which makes it almost impossible to watch.
    Even with 0.5 it is very hard on the eyes.

    So I then looked at the animation and found that if I selected: bake into pose in the section Root Transform Position (Y), then it worked great.

    jon
     
  8. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,745
    Sounds good to me