Search Unity

Frame Transposer on a Track path?

Discussion in 'Cinemachine' started by LittleCatman, Feb 2, 2019.

  1. LittleCatman

    LittleCatman

    Joined:
    Nov 8, 2016
    Posts:
    6
    Is it possible to make a virtual camera use both a Frame Transposer and Tracked Dolly path?

    I'd like to be able to restrict my camera's movement to the path while at the same time having access to look ahead, dead zone, and soft zone.
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    Those two algorithms will fight. One will position the camera based on target position, the other based on path position. Which one should win? Can you describe in a little more detail the precise behaviour you're looking for?
     
  3. LittleCatman

    LittleCatman

    Joined:
    Nov 8, 2016
    Posts:
    6
    I thought the two might conflict with one another, but I was holding out hope. I'll likely rework my system, but here's what I'd been going for:

    I use tracks to limit the camera's movement to a single axis based on the shape of the room it's assigned to. Horizontal rooms generate horizontal tracks. Vertical rooms, vertical tracks. I was also considering it might be useful for sloped rooms. (I also use the tracks for some manual offset stuff, since I sometimes need to offset the camera differently at the top of a room compared to the bottom.)

    I realize this is meant to be achieved with a confiner, but I felt like a track was more "bullet-proof." With tracks, I feel confident that my camera will go exactly where I want it because I can clearly define the path it's allowed to take, rather than using a confiner to try to tell it where it can't.

    Probably a silly distinction, but that's where I was coming from.
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    You can probably make your own custom confiner which takes a path instead of a collider. Let the vcam position itself where it wants, then your custom confiner can find the closest point on the path and force the vcam there. That's what the current confiner does, except is uses a Collider instead of a path.

    Copy the CinemachineConfiner class, and modify it to use a path instead. It will be auto-detected by the UI and available in the vcam's Extensions dropdown.

    Feel free to post the code here if it works out for you.
     
    LittleCatman likes this.
  5. LittleCatman

    LittleCatman

    Joined:
    Nov 8, 2016
    Posts:
    6
    Interesting! I've already reworked my current setup to use standard confiners. If I encounter problems with the current setup, I'll look into making a custom path confiner class like you suggested. Thanks for the tip!