Search Unity

Feedback Look Ahead Woes

Discussion in 'Cinemachine' started by Baste, Apr 10, 2019.

  1. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    Look ahead is a really good way to make cameras feel good. I wrote a pretty extensive look ahead system for the camera in World to the West, and I was exited to see that there's a native look ahead in Cinemachine. There's some problems that make it less than ideal for a player-tracking camera, though.

    Damp back
    The first problem is that the look ahead damps back to zero when the target stops moving. For the kind of game we're making, the look ahead point should freeze when the player stops moving. So if you run towards the right, and then stop moving, the camera should stay shifted to the right until the player starts moving again.

    Here's a demonstration of the current behaviour:


    Here's the same behaviour, with game view guides included:

    As you can tell, when the player stops moving, the guide point damps back towards where the player's standing.

    Here's the behaviour I want, implemented by having the camera follow a custom transform that does the look ahead work (with zero built-in damping.)


    Here's the same thing, with guides included.


    There's two reasons why I want my version of damping. The first one is simply feel - I think it feels better as a player. The built-in behaviour causes a movement in the opposite direction of the direction the player was inputting, which goes counter to the player intention, and also makes the player very aware that the camera is moving. Ideally, the camera movement should be "invisible" to the player when they're in control of the game.

    The second reason has to do with what we're using look-ahead for. When the player's moving in a direction, they're probably more interested in the things that lie in that direction than the things that are behind them. Look ahead allows us to fill more of the screen with what the player's encountering rather than what they're done with. With the built-in behaviour, we lose this immediately when the player comes to rest, which is a bummer.

    Now, I can implement this myself. I've done it already, as you can tell. But, it's always better when the behaviour is more tightly integrated into the solution. There's also the issue where if you fix my second large problem with look ahead, my custom solution won't be fixed. Which brings us to large problem number 2.

    Collision extension/look ahead issues.
    Here, I've got a camera with look ahead and a collision extension. And just look at this disaster:


    It's pretty easy to understand what's happening when you add guides:
    https://www.youtube.com/watch?v=n-Ge-3Ri_nw&feature=youtu.be

    As you can tell, look ahead causes the guide point to become visible to the camera. This causes the collision component to consider the target "in view", so it stops moving the camera out of the way.

    I've got some pretty extreme settings* here, low collision damping, no minimum occlusion time, and maximum lookahead time. I could get a better behaviour by tuning those, but it doesn't seem like I can get good results.

    I think that the collider extension should (perhaps optionally) not take look ahead into account. In essence, the collision component should make sure that the target is visible, not that the look ahead offset position is visible.


    That's a wall of text, but I hope it's digestable. I can't stress enough how great Cinemachine is, this is the only major hurdle I've run into that doesn't seem to be either me being an idiot, or a learning hurdle. If there's built-in ways to fix these issues, I'd love to hear about it.

    If there's not, I can always go in and write my own collider by copying the built-in one and making adjustments ( <3 ), but I assume this is an issue other people will run into.


    * Settings used:
    upload_2019-4-10_18-6-31.png
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    Thanks for that. We really appreciate your excellent feedback. I like both of your suggestions.
     
    Baste likes this.
  3. Adam_Myhill

    Adam_Myhill

    Joined:
    Dec 22, 2016
    Posts:
    342
    Some excellent points there @Baste . Gregory and I are in alignment on them, we agree and it's been added to our schedule. Thanks so much for reaching out with that super detailed feedback.
     
    Baste likes this.
  4. Carrmichaelll

    Carrmichaelll

    Joined:
    Nov 30, 2016
    Posts:
    68
    Hi Adam, i'm Also using using this cinemachine feature for a top down game and would love an option to choose if the look ahead functionality takes the player's forward direction into account as more often than not this is where the player tends to move to, I've found that this is very ideal for a top down shooter game which i am developing right now and this helps to see targets further from your regular view when a player looks in said direction as opposed to having to move in a certain direction before the look ahead function takes effect.
     

    Attached Files:

  5. SugarChap

    SugarChap

    Joined:
    Jan 19, 2015
    Posts:
    28
    I'm going to necro this thread (apologies) but wondered if this features is now released, and if so how can I enable it?
     
  6. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    Pretty sure there was an implementation of this last I checked. Not 100% sure, though.
     
  7. SugarChap

    SugarChap

    Joined:
    Jan 19, 2015
    Posts:
    28
    Thanks! I've had a good rummage around and I'm having trouble finding where that setting is. Was it a particular version? Or a toggle-able feature?
     
  8. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    Unfortunately this feature did not make it in. I would suggest that you implement your own lookahead on an empty game object that behaves the way you want, and set your look at target to that.
     
    SugarChap likes this.