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

Cinemachine for flythrough videos.

Discussion in 'Cinemachine' started by username132323232, Jul 19, 2017.

  1. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    477
    I'm working on a flythrough video and would like to find out how to aim the camera along a path. I already have a CM vcam moving along a DollyTrack, but I don't want it to aim at a particular object.

    BTW, it would be great to have an example scene or a tutorial about using Cinemachine for flythrough videos. I know it's probably the simplest use case, but there are some things that are not so obvious for beginners like myself:)
     
  2. JakubSmaga

    JakubSmaga

    Joined:
    Aug 5, 2015
    Posts:
    417
    Have you tried creating animation for the CM vcam where you would just animate it's rotation?
     
  3. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    Very easy. Don't set a LookAt target on your vcam. Set the CameraUp setting in TrackedDolly to Path. The effect will be that of a rigid camera rig on a track.
     
    username132323232 and JakubSmaga like this.
  4. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    477
    Thanks for such a quick response! It works, but the camera does some fancy moves at each waypoint: it switches 180 degrees and then slowly turns back 180. What do you thing I missed?

    Also, is it possible to adjust a Dolly Track as a bezier curve to make the camera move more smoothly? Sorry for such basic questions. I'm really new to Cinemachine.
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    The railroad-tracks in the path give an indication of its smoothness. If they wiggle around, then so will your camera. Place the waypoints carefully and evenly, and adjust the tangents with care to make the path smooth. It's just a bezier under the hood.

    Each waypoint has a roll setting, so that you can bank the track. Note that there are options in the CameraUp setting to remove roll, if that's what you need.
     
  6. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    477
    Greg, what if I just wanted a smooth curved path on a flat surface? No rolls. Is that possible?
     
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    Yes it's possible. Put all waypoints and tangents in the plane. Set the roll in all waypoints to 0. Or use the CameraUp "PathNoRoll" option.
     
    JamesArndt likes this.
  8. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    477
    Thanks again. You've been really helpful! I'm getting a hang of making smooth Dolly Tracks now. Any way to create them programmatically or better yet import a path created with other software (Illustrator, Blender, etc.)?
     
  9. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    You can create them programmatically by adding waypoints to the waypoint array. Currently Unity does not provide an importer for these paths, but you could always write one :)
     
  10. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    477
    Is there an API call for that?
     
  11. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    Sure. CinemachinePath.m_Waypoints is the array that holds the waypoints. Manipulate it as you like.
     
  12. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    477
    Wow! That's great. BTW, do you think NURBS-based dolly track would be useful? I've heard that NURBS provides smooth paths by default. I know bezier is more versatile, but I think most people would want a smooth dolly track any way.
     
  13. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    CinemachinePath inherits from CinemachinePathBase. The TrackedDolly behaviour can be hooked up to any path that is derived from CinemachinePathBase. You can write your own path class implementing NURBS, or an imported path, or whatever you like. Let us know if you come up with something cool!
     
  14. Adam_Myhill

    Adam_Myhill

    Joined:
    Dec 22, 2016
    Posts:
    342
    @username132323232 NURBS are cool but they can be really fiddly in practice since the path doesn't go through the control points like it does with beziers

    I've found that you get a bit more smoothness right away with NURBS but then they start to drive you crazy because you're only indirectly defining the path position instead of directly with a bezier method.

    If you do go down that road, please let us know how it goes
     
  15. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    477
    Thanks Adam. I see what you mean and I agree. It does look like bezier is more appropriate than NURBS. I'm just starting with Cinemachine (which super-cool!) and hopefully will get better with using the waypoint tools :) If I wanted to add some functionality (like automatic path smoothing), which script file would I need to work with?

    Also, I think in many cases it would be easier to build the dolly track in 2D (fixed Y) and then expand it to 3D if required. How about adding a "lock" option for each axis coordinate and tangent?
     
  16. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    Everything you need is in CinemachinePath.cs and CinemachinePathEditor.cs.
     
  17. username132323232

    username132323232

    Joined:
    Dec 9, 2014
    Posts:
    477
    Thanks Gregory! I'm working on a bunch of other stuff right now, but can't wait to jump on CinemachinePathEditor.cs. It should be fun :)
     
  18. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    Looking forward to see where you take this :)