Search Unity

Freelook to Freelook - How to Aim Consistently?

Discussion in 'Cinemachine' started by FuriousEX, Jan 9, 2019.

  1. FuriousEX

    FuriousEX

    Joined:
    Mar 13, 2014
    Posts:
    6
    Hey guys, any thoughts on how you might do a freelook camera that transitions to another freelook camera, while maintaining the camera interest/aim?

    For example, a 3rd person game like Uncharted uses a different camera composition for movement vs aiming down sights cameras. When you transition to one and back, the reticle scsreen position aims at the same world position, yet they are both freelook style cameras.

    Do you think such a thing is possible with cinemachine currently?

    Thanks!
     
    sd1515 likes this.
  2. Adam_Myhill

    Adam_Myhill

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    325
    It's possible. We've had many freelooks blending based on character animation, position in the world, weapon use, etc.

    Make sure to have Inherit Position checked on:
    upload_2019-1-11_14-12-26.png

    And make sure each freelook is actually aiming at the same target.

    You'll probably want to drive the whole thing with the State Driven Camera module. It allows you to trigger cameras based on animation states and setup custom blending between any two cameras

    Take a look at this SDC setup. Animation states call specific FL cameras. There's custom blending into and out of each state/camera, including wildcards **ANY CAMERA**. It's a powerful system which can get very sophisticated, Uncharted level behaviors. Combining this with world triggers - call a close FL when the character goes in a tunnel, etc. - you can build a very polished game camera setup
    upload_2019-1-11_14-17-12.png
     
  3. FuriousEX

    FuriousEX

    Joined:
    Mar 13, 2014
    Posts:
    6
    Thanks for the quick response! The SDC sounds great but perhaps not relevant to this precise problem. I've tried a bunch of settings permutations to do this FreeLook to FreeLook transition and but am still unable to get consistent results without the FreeLook camera settings being nearly identical to one another. Maybe I'm misunderstanding the role of the Look At transform, but it seems like Inherit Position might not be enough for this to work as-is.

    Here's a clearer example of the problem I'm trying to solve:
    • 3rd person game where you can shoot from the hip.
      • Your reticle is fixed at screen center.
    • This screen composition has the character fully in frame somewhere between the left 3rd and center.
    • You can hold the left trigger to aim down the sights of your weapon.
      • When you do this aim the reticle in screen center remains aiming at the exact 3D position as the hip aim, but the composition relative to the character changes.
    • This aiming composition now has the camera much closer and is zoomed in, the character is hard on the left 3rd, and his neck is down on the bottom third so you can only see his head and the top of his upper torso.
    I've been using the Look At at a point somewhere around the character's head and the Follow at the base of the character - the same transforms for both cameras.

    I think the system would need to know the aim world position for consistency, but building that into the Look At point would fight the FreeLook controls, if I am understanding it correctly.

    Thoughts?
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,501
    There's a thing currently with InheritPosition: for it to work optimally, you need to have the LookAt and Follow be the same point. A good way to do that is to put an empty GameObject in your character at the point in question (say somewhere near the head) and use that for both targets.

    Next, in order to keep the reticle in the same spot when the camera changes, there are 2 options:
    1. Don't move the camera except along its z axis. Zoom is fine, but if you're going to displace the camera, moving it off its z axis will change the perspective, and the result will be that the reticle will usually shift relative to the world. Set up your various orbits to make sure that the camera motion follows this rule when the cameras change.
    2. If you must move the camera off-axis, then your only option is to have the camera aiming at the nearest object under the reticle, which you'll have to update dynamically. In that case you'll need a completely different setup.