Search Unity

"points of interest" transition

Discussion in 'Cinemachine' started by Tom163, Sep 22, 2020.

  1. Tom163

    Tom163

    Joined:
    Nov 30, 2007
    Posts:
    1,290
    I'm new to Cinemachine, so apologies if this is really trivial, but I've read the docs and experimented and can't figure it out.

    I have a bunch of 3D scenes with "points of interest" that I want to transition between, by moving the camera. For each POI I have a good camera position and rotation that I want to use.

    Moving between them is my issue. I've tried it with animations, which gives me great control, but the number of animations just explodes. For 3 POIs it's very manageable, for 4 tedious, above that just too much work.

    I thought about Cinemachine dolly tracks, but it's almost the same problem - I need to build tracks between all points.

    I'm sure there's a better way, where I can somehow tell the camera "move from your current position to position 5, avoid all colliders" or "go from waypoint to waypoint inbetween" or something like that? I have a kind of paths that I can follow with the camera, or I can block off regions I want it to avoid using colliders.

    I seriously thought about using the NavMesh for this, but then I thought Cinemachine certainly has a solution. But it evades me so far. Anyone can point me in the right direction ?
     
  2. marc_tanenbaum

    marc_tanenbaum

    Unity Technologies

    Joined:
    Oct 22, 2014
    Posts:
    637
    Hi @Tom163

    In Cinemachine, the usual approach to this problem is to create a Virtual Camera at each point of interest (so you have 1 Camera and many VCams – the VCams are like bookmarks of camera positions/configurations you like). The transitions between them are managed by Cinemachine, so no need for animations or dolly tacks. So all you need to do after positioning the VCams is alter their relative priority values.
     
    Gregoryl likes this.
  3. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    To build on what @marc_tanenbaum said, this will work so long as simple blends between the POIs will suffice. If you want to the camera to move along more complex paths, or avoid obstacles while they transition, then you will need to do a little more work.
     
  4. Tom163

    Tom163

    Joined:
    Nov 30, 2007
    Posts:
    1,290
    Yes, I specifically want to MOVE the camera. I'd know how to transition with a blending or other effect, but I want the camera to move along a path.

    Here's what I did with animations (the village scene) and a Cinemachine Dolly Track (the forest scene):
    https://www.patreon.com/posts/41391214

    The problem is that the village scene has 3 POIs - that's 6 animations I need to cover every "from A to B" possibility. But a larger scene I'm working on has 6 POIs - that's 6x5 = 30 animations I'd have to make. For every such scene of which I'll be having at least 10 in the end, so I'm looking at manually making around 300 animations - or finding a smarter solution.
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    In Cinemachine, when we speak about blends and transitions between vcams, we mean that the camera will move and rotate from the first vcam's location to the next one's. We're not talking about dissolves, or other such pixel-based blends. So you'll get camera movement by default, without having to animate anything.

    The issue I see is that you want control over the path that the camera takes as it transitions, either that it must avoid obstacles, or that it must travel along some specific route.

    If you can set up your scene such that the default transitions work in most cases, that's a big win. You can tweak the transition style a little bit (linear path vs. cylindrical or spherical) by setting this option:

    upload_2020-9-23_8-46-0.png

    Note that to get the best blends the vcams need a sensible LookAt target (it could be an empty point in space) - they will make the effort to blend cleanly from one focus point to the next without looking in weird directions in between.

    However, if you want - in the general case - for the blending vcams to avoid going through walls or trees without having to worry about where you put them, you will need a smarter solution.
     
  6. Tom163

    Tom163

    Joined:
    Nov 30, 2007
    Posts:
    1,290
    Thanks for the extensive answer. Yes, it seems I will need a smarter solution.

    I'm experimenting. Using animations works well in most cases, but not in all. I'm thinking of replacing it with dolly tracks and simply put the camera on different tracks depending which transition I need. But using animations gives me much finer control over every detail. So it's an interesting challenge to find the best way to do it.
     
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Sometimes it's a bit difficult to animate camera rotations directly. One way to make it easier is to animate the camera position and the camera LookAt point and tell the camera to procedurally look at the animated LookAt point.