Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Where do I view the sample scenes of Cinemachine?

Discussion in 'Cinemachine' started by nuxmakesgames, Jul 2, 2020.

  1. nuxmakesgames

    nuxmakesgames

    Joined:
    Jun 8, 2016
    Posts:
    4
    As the title says.

    I've been trying to implement a camera system like in Hollow Knight where if the player character presses the left/right button, the camera will offset itself a small distance away. The thing is, while I do know that this can be done using the m_ScreenX, and such as the documentation says, I can't figure out how and where to put these components together.

    Will some script attached to a virtualCam on an Update() method do it? Where can I find the virtualCam's velocity/transform if I want to have one camera transition to another camera if it lets say reaches a certain velocity? (like if 1 cam goes too fast, cam 2 will move further than the player character's velocity.) Like how can I manually change how fast the virtual camera will tell the main camera to move under certain situations?

    Now I've read around the forum that Cinemachine has sample scenes to play around with, but I do not know how or where to access them. Does it have its own Github page that has them there or are they only found in the Unity App store?

    Sorry if I'm speaking nonsense, I've been stuck at this problem for a while now. Any help is appreciated.
     
  2. marc_tanenbaum

    marc_tanenbaum

    Unity Technologies

    Joined:
    Oct 22, 2014
    Posts:
    637
    hi @nuxmakesgames and welcome to the forum!

    So the easy half of your question: samples are downloadable via the Package Manager. Take a look at the third screenshot in this post (I've highlighted the button in red): https://forum.unity.com/threads/cinemachine-2-6-official.922316/

    In terms of your intent, you might try looking at Lookahead Time in the Framing Transposer. This allows the camera to lead the target...and might take care of what you're trying to do without any extra code.

    Hope that helps!
     
    art092 and nuxmakesgames like this.
  3. nuxmakesgames

    nuxmakesgames

    Joined:
    Jun 8, 2016
    Posts:
    4
    Ah, thank you! I finally found the import button on the Cinemachine tab at the top of the Unity file bar.

    I was wondering if there was a way to code the Lookahead Time to stay at a certain point, (lets say, 5 units to the left of the character, even if the character was lets say, jumping or sliding upwards of a wall,) or probably any extension within Cinemachine that will allow me to do this? Code samples from content creators for Cinemachine are few and far between.

    But still, thank you so much for responding!
     
  4. marc_tanenbaum

    marc_tanenbaum

    Unity Technologies

    Joined:
    Oct 22, 2014
    Posts:
    637
    Hm....

    So m_LookaheadTime is a property of the FramingTransposer.

    ...but I'm beginning to think that what you're after isn't lookahead or screenX positioning, but rather confinement. By this I mean, for example, that the player hits the far right edge of the play space and you want the camera to stop so that everything to the left of the player is visible, but nothing to the right. Is this correct? We have a tool for this purpose. (In the samples, check out a scene called '2DConfiner').
     
    nuxmakesgames likes this.
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,238
    You seem to be using an outdated version of Cinemachine. What version are you using? You can find out here:

    upload_2020-7-3_8-39-44.png
     
    nuxmakesgames likes this.