Search Unity

Free Look - smooth movement vs. responsive controls

Discussion in 'Cinemachine' started by shedworksdigital, Sep 21, 2017.

  1. shedworksdigital

    shedworksdigital

    Joined:
    Nov 7, 2016
    Posts:
    40
    I've been using a Free Look camera in my third-person game, and I want to start a discussion here about how to use body and aim damping to get nice, smooth movements while keeping everything feeling responsive to your input.

    Firstly - x, y and z damping on the body. I would like to use damping so it doesn't feel like the camera is locked at a fixed offset from the character. I like that if the character starts running, or jumps in the air, the camera takes a bit of time to start following. My problem with this is that the damping also applies when I move the camera with axis input, which makes the controls feel sluggish. I would guess this is because the position of the camera is decided something like this:

    Code (CSharp):
    1. Vector3 origin = follow.position;
    2. Vector3 offset = // offset based on x and y axis values, blended between top/middle or middle/bottom
    3. Vector3 targetPosition = origin + offset;
    4. transform.position = // smoothing function from current position towards targetPosition
    It would be really helpful to me if I had the option to apply the damping to the origin position instead. Something along the lines of this:

    Code (CSharp):
    1. Vector3 origin = // smoothing function from current origin towards follow.position
    2. Vector3 offset = // same as above
    3. transform.position = origin + offset;
    4.  
    This would mean there's smoothing when the target moves through the world, but the camera moves instantaneously when I'm controlling it directly, and the only number I have to think about when tuning the responsiveness of the controls is the axis acceleration.

    I have a similar problem with aim damping, though I'm not entirely sure what the solution is there. I would really like to be able to have soft zones around the character - again, if I jump in the air it would be nice for the aim to take a bit of time to follow the player upwards. This just doesn't seem to play nicely with axis input, for the same sort of reason that it feels sluggish and unintuitive to control. I understand the philosophy behind the transposer and the composer being totally independent, so axis input will update the position of the camera's transform, and then the composer reacts to the new situation and reorients to accommodate. I suppose what I'm really looking for is a transposer that updates itself similarly to the Transform.RotateAround function, but I can't fully hold in my head what this would feel like.

    I don't doubt these are all things that came up in the process of building Cinemachine, and its totally possible there are fatal flaws in my thinking here, but I would love to hear about any tips/pitfalls that people have learned when using the Free Look camera in a third-person game.
     
  2. Adam_Myhill

    Adam_Myhill

    Joined:
    Dec 22, 2016
    Posts:
    342
    Hey Gregory, I think we should release the latest CM beta...

    @shedworksdigital - the latest CM has improvements to FreeLook in exactly this area. We'd love for you to try it and see if it addresses those issues. It's a really delicate setup getting all the stuff to work together in desired ways. I think this last version is going to make big difference.

    Note - you can have different y damping depending on the FL orbit low/mid/high etc. It works a treat to have a little Y damping on the bottom one, more on the middle and yet more still on the top. It really helps sell jumps having the character move in the frame - just the right amount based on the camera angle.

    I'll get a post together to share the latest CM beta
     
    Corvwyn and shedworksdigital like this.
  3. shedworksdigital

    shedworksdigital

    Joined:
    Nov 7, 2016
    Posts:
    40
    That's good to hear! I'm excited to take a look at the beta, and I'll try out this y damping trick. I spent a fair bit of time honing my jump arc, and the camera just woodenly following you off the ground was killing it somewhat ;)
     
    Adam_Myhill likes this.
  4. shedworksdigital

    shedworksdigital

    Joined:
    Nov 7, 2016
    Posts:
    40
    Just had a go on the 2.1a release candidate and this is everything I was looking for! I feel like I have a much wider array of parameters at my disposal now than I did previously. Excellent job, guys.
     
    Adam_Myhill and Gregoryl like this.