Search Unity

Group Hero/Target and Look Ahead: Possible?

Discussion in 'Cinemachine' started by Deeeds, Apr 20, 2018.

  1. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    With the ability to focus on a group, can this be made to consider the hero/target and the look ahead gizmo as a group to focus on?

    Please excuse me if this has been answered or addressed in some way.

    I couldn't initially find or correctly use teleporting/warping, and often struggle with the gap between my limited lexicon and that of those able to dream up, design and implement APIs and tools.
     
  2. Adam_Myhill

    Adam_Myhill

    Joined:
    Dec 22, 2016
    Posts:
    342
    Not totally sure what you're asking here. Seems like two questions.

    Focus on a group. Yes, there's the Target Group camera which can focus on a group of objects, or you can just use the Target Group object by itself and use it with other types of CM cameras. You can set the Composer to 'look ahead' when tracking a TargetGroup (or any object) so then you can do what I think? you're asking here : consider the hero/target and the look ahead gizmo as a group to focus on?

    As for teleport - there's a thread here: https://forum.unity.com/threads/rep...how-to-avoid-the-popping.514293/#post-3462846

    There's a few other mentions of teleport in the CM forums, best to do a search and see what answers fit your scenario. If none do, please reach out again with some more information.
     
  3. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    Can I make the Look Ahead "object" part of the TargetGroup?

    By the Look Ahead "object", I mean the thing drawn in the Game view that's ahead of the target object or group by the specified amount. It's a yellow looking dot.
     
  4. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    On the teleporting stuff, I'm talking about the fact that I have to ask stupid questions in my narrow lexicon. And that it sometimes takes me some time to sort things out... not a coder. Bit of a clueless git when it comes to the language of programmers.

    I eventually found it, but didn't find the right "tree" of knowledge about it, nor the ways to the fuller tree, so was accessing the warp function through the base component rather than the CM Camera, until Gregoryl set me straight.

    I will make these kinds of mistakes often.
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    No, the composer's lookahead isn't a separate object, so you can't add it to a group. You could make a child object of your target, that implements its own lookahead based on velocity (you could re-use the CM Lookahead code for that, it's modular enough) and add that child to the group. That would effectively achieve what you're looking for here.
     
    Deeeds likes this.
  6. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    sorry, stupid question approaching...

    where do I find the CM Lookahead code?
     
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    It's in predictor.cs, but I just checked... it's marked "internal" so technically you can't use it :(
    But you can copy/paste it.

    Search the CM code for "PositionPredictor" to see how it's used.
     
    Deeeds likes this.
  8. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739

    THANK YOU!!!

    This is the kind of "tutorial" and insight I desperately needed into using Unity. It's incredible.

    I will learn much and forget more.

    Btw, the only folder (in my system) Cinemachine shows up in, with these files, is the one in which I installed the 2D GameKit. I have two projects with Cinemachine installed, both of which have turned it into garbled/obscured file names.
     
  9. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Delete the one that came with the 2D Game Kit. It's old. Get the latest Cinemachine from the asset store if you're using 2017, or from the Package Manager if you're using 2018.
     
  10. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    I'm using the one from Package Manager, latest, with 2018.1 b13, but it's all obscured. Here's my search results for Predictor.cs, bottom plain english results are in the 2D GameKit project. Screen Shot 2018-04-21 at 12.11.05 pm.png
     
  11. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739

    Possible quick and easy:
    Could I constantly "get" the position of the look ahead thingamebob from CM, move a dummy object to that position each frame/tick, and add the dummy object to a target group with the hero?
     
  12. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Excellent idea. Just what I was going to propose :)
     
  13. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    GREAT!

    Here's the bad/sad news, in two parts:

    I can only find that 2D Game Kit version of the .cs CM files on my Mac, despite having CM installed via Package Manager in my projects.

    I have no idea what to call/get to find the position of the Look Ahead doodad.

    Sorry to bother you.

    And, thank you!!! I'm relieved to know my idea isn't bad.
     
  14. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    CinemachineComposer.TrackedPoint is how Unity places the little yellow dot. That should do it for you.

    Keep using the package manager version. If you also have Cinemachine as an asset in your project, I would delete it to reduce confusion.
     
    Deeeds likes this.
  15. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    Yes! That works!

    I'm only using Package Manager version of latest CM in my projects. I have one, separate, project for checking out the content and coding strategies of what's in the 2D Game Kit.
     
    Gregoryl likes this.