I’ve been trying to figure out Cinemachine the last couple days. I feel like what I’m trying to do is fairly simple, but I’m having trouble understanding how to do it with CM effectively.
When my scene loads, I want the camera to stay still for a bit before slowly moving backwards. After a brief pause at the end, I’d like it to move forward and follow a track, facing forward in the direction of movement. At the end of the track, it’ll be facing a world space menu and the cinematic track ends.
From that point, I’d like to be able to use the various virtual cameras I have setup around the scene as points I can pan the camera to depending on what’s selected in the UI. I have the virtual camera references and everything, but I can’t seem to figure out how to get the camera to transition to them.
After playing a CineMachine timeline, how do I switch to other virtual cameras? I’ve tried calling
MoveToTopOfPrioritySubqueue on the virtual camera I want, deactivating other cameras, changing priorities… nothing seems to work. I’ve even tried calling Pause on the camera’s PlayableDirector component as I saw suggested elsewhere with no results.
Any tips on making a setup for basic camera movements? I’ve tried using dolly tracks with carts, but I can’t seem to find how to make them run in sequence (wait, pan back, move forward).
Am I even doing this right? I’m getting the feeling that I shouldn’t be trying to compose shots with cameras directly, but rather have an invisible object I move/animate instead and just let CM decide how the camera will behave. That doesn’t feel right, though, as I have very specific shots I’d like to do and a system this big seems like it should be able to do that.
Cinemachine’s priority system will cause the the vcam with the highest priority to control the main camera. If multiple vcams share the highest priority, then the vcam on which MoveToTopOfPrioritySubqueue was most recently called will win, unless a new vcam is created at or elevated to the same priority even more recently, in which case that one will win.
You can make a simple test scene with several vcams, and play with their priorities in the inspector to see that in action.
A Cinemachine track in the timeline functions as an override for the priority system. While a CM timeline clip is active, priority is ignored and timeline wins. If you have multiple CM timeline tracks, newer ones override older ones, in a stack. What’s interesting about this is that by having ease-in and ease-out times on the clips, you can blend into and out of whatever the clip is overriding. This is very powerful.
If you have specific canned camera movement that you want to create, you can animate a passive vcam just as you would animate a camera, and put a CM clip in the same timeline that activates that vcam. A passive vcam is just a CinemachineVirtualCamera with DoNothing in Aim and Body, so it does no procedural tracking and you can position it how you like. You could animate your opening shot that way. No need to use a dolly cart and track (although you could: just animate the cart’s position field).
Once you reach the menu, activate a new timeline that has only a single CM clip for the menu vcam, with an ease-out time so that it blends to the selected vcam. Set the timeline’s timescale to 0 so that the timeline doesn’t advance. Then, when the user clicks on a menu item, place the selected vcam at a higher priority than the others, and set the timeline’s timescale to nonzero so that the timeline advances and blends to the selected vcam.
Thanks, @Gregoryl . I liked the idea of a dolly cart because – it having a speed property – it seemed like an easy way to have my camera move at a consistent speed through the scene. I think I’ll give that a try. Is there a reason why I should animate the cart’s Position property directly instead of just setting its Speed (from a starting value of 0) to something and letting it run?
As far as the menu cameras go, I’m going to have a good many of them… say 6 to 10, maybe. Instead of having that many timeline assets with one vcam each, is it viable to just unload the timeline asset from the Playable Director and strictly use priority and default blending to change camera views at that point? Any reason you know of why that wouldn’t work?
Animating the position gives you precise control. Speed is an indirect control, and is therefore more fragile. Set it to 0 and animate the position. It’s very easy in the animator to give it a consistent speed: just make a straight line between the keypoints.
I don’t quite understand what you’re proposing. As soon as the timeline deactivates, the priority system takes over. You can set the menu vcam’s priority to be highest, so that when the menu timeline finishes, the menu vcam will remain active (without a timeline) while you wait for the user’s choice. When the user clicks on a vcam, raise that vcam’s priority to be higher than the menu vcam’s, and you will get a blend.
It turns out I wasn’t so far off with what I was attempting, and @Gregoryl 's responses definitely helped me figure it out. I had my PlayableDirector’s Wrap Mode set to Hold after finishing, because otherwise the camera switched back to the first vcam upon completion of the timeline. In actuality, what I wanted to do was set Wrap Mode to None, and ensure the last camera in the sequence had the largest priority value. That way, as Gregoryl indicated, that camera would become the primary once the timeline finished. From there I just change out priority values as needed and the transitions work great.