Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Look ahead woes, volume 2

Discussion in 'Cinemachine' started by Awarisu, Jul 20, 2019.

  1. Awarisu

    Awarisu

    Joined:
    May 6, 2019
    Posts:
    215
    I have a character that moves by performing a series of jumps, think of something like a sack race. Because of this jerky movement pattern I need relatively high smoothing on the vcam (3,5,3) to have the camera move smoothly, and a relatively high lookahead (0.4) to make the sure the camera is a little ahead of the character so you can see more in the direction you're moving. When the character stops, the camera keeps moving ahead to reach the lookahead point that it was following, because it's kept at its last position when your animation stops. I presume that is because of the "Look ahead woes" thread (I can't link to it because apparently that's spam)

    In my situation I could work with the old behavior better, although ideally I'd need just the ability to make the camera stop tracking the lookahead point when my character stops moving and just end up with whatever position the vcam had at that point (plus a small error as the cam smoothly stops moving) instead of the camera moving along the entire lookahead length. I've tried using dead zones but they make the situation even worse, requiring even more lookahead, etc.

    I could definitely achieve what I'd like with a "look at this GameObject instead of the character" and just rolling my own smoothing and lookahead script but ideally I'd like this to be configurable on Cinemachine itself.
     
  2. Alic

    Alic

    Joined:
    Aug 6, 2013
    Posts:
    137
    I would really just use a separate smoothed object following the player at all times, just as you said. All cinemachine features will still be usable on top of that smoothing, but you'll also be getting exactly the behavior you want, and after a quick setup you'll never have to think about it again.

    Originally I did this because I wanted to get my perspective camera to stop at the edges of the level and let the player continue to move to the edge of the screen, and doing a setup with an object following the player was the easiest way I could do it. But the extra control over smoothing is really nice to have.

    Anyway, just my advice based on recent personal experience.
     
    Gregoryl likes this.
  3. Adam_Myhill

    Adam_Myhill

    Joined:
    Dec 22, 2016
    Posts:
    342
    Good solution @Alic and you were correct from the start @Lorash

    CM's Look Ahead isn't perfect but it's simple and gets the concept across. You'll want to tune your particular look ahead behavior based on things we could never envision so you're both right to target some empty object which you drive from the character however you exactly want.

    This is a good time to mention, I practically NEVER follow the player or object directly in CM. It's always some other object or a Target Group - check them out they're SO SO powerful. Make a Target Group camera from the top menu and rip away the target group object. 90% of the time my shots are looking at Target Groups which I then populate with whatever character/vehicle stuff.

    Let me know if this isn't clear.. in fact, you've made me realize I should probably do a post on just exactly this....
     
    Alic likes this.
  4. Alic

    Alic

    Joined:
    Aug 6, 2013
    Posts:
    137
    Yep, Target Groups are awesome! I built an entire combat camera system based on something like Grandia III (think Final Fantasy VII style camera where the camera is constantly orbiting around and zooming in on the action/guiding the player's focus) which perfectly keeps all the important characters on screen at all times and even does cutscene cutaways when a character is using a special ability. And because of target groups and a couple of other features, it took ONE DAY. Cinemachine literally saving people weeks to months of dev time :)
     
    Last edited: Jul 25, 2019
    Adam_Myhill likes this.