Search Unity

Is there any way to move virtual camera via a move tool in timeline?

Discussion in 'Cinemachine' started by pkumarshall, Jun 24, 2021.

  1. pkumarshall

    pkumarshall

    Joined:
    Aug 3, 2018
    Posts:
    11
    Hi, guys, is there a way to move virtual camera via a move tool(like that is circled in image#1) in timeline, or any other more efficient method to positioning virtual camera other than typing coordinates in transform text area(circled in image#2)?
    Thanks!
    upload_2021-6-24_9-36-32.png upload_2021-6-24_9-37-1.png
     
  2. pkumarshall

    pkumarshall

    Joined:
    Aug 3, 2018
    Posts:
    11
    @Gregoryl Hi, sir, please help me solve my question, thanks!
     
  3. marc_tanenbaum

    marc_tanenbaum

    Unity Technologies

    Joined:
    Oct 22, 2014
    Posts:
    637
    Gregory and the team are on their annual hackweek, so might not be able to help out until next week.

    You can use all the normal tools you would use for a non-Timelined camera (inspector, Scene View gizmos, etc). But note that in the image you've posted for camera is constrained by its follow target (3rd Person Follow of MC_001). That constraint may be keeping you from doing what you want.
     
  4. pkumarshall

    pkumarshall

    Joined:
    Aug 3, 2018
    Posts:
    11
    Thank you for your reply, sir. Let me explain my problem in more detial, or you could just see the attachments:
    1. I set all character's position as ‘Apply Transform offset’ in timeline animation track.
    2. Then I tried to adjust the virtual camera's position here by typing in coordinates, which seems a little bit inefficient, because I didn't know what number I should type in to get the camera in the correct position. Of course I can jump out of timeline editor and use normal tools, but when I did that, all characters that I set position in timeline by selecting 'Apply Transform Offsets' (marked in Image#1) were reset to their default position, so I still cannot know whether the camera was in right position. I really want to know in timeline, is there a way to use a move tool, like the one used in animation track, to adjust Cinemachine virtual camera's postion?

    Do I have some misunderstandings about the work flow, or I need to create a customized editor for this requirement? Also, I didn't find the API of move/rotate tool button for customized editor.

    Thanks for your help!
     

    Attached Files:

  5. marc_tanenbaum

    marc_tanenbaum

    Unity Technologies

    Joined:
    Oct 22, 2014
    Posts:
    637
    Thanks for the very clear explanation in the images.

    There's an important difference between image you showed in the original post and what you're showing here: this second camera is not constrained (it's not set to follow of look at anything). In this case, there should be no relationship whatsoever between the Cinemachine camera and the Animation track shown in image 1. I.e., you can use the regular Cinemachine controls to reposition your view, and there should be no effect at all on what's happening in that other track.

    I'm not a Timeline expert – so I'm not sure what to suggest is the problem here – but I use it a fair bit to create shots like this one. I don't use the Cinemachine Clip inspector to do this type of work...just the regular Cinemachine controls, so I can assure you that you don't need to limit yourself to the inspector. The cause of the reset is unclear to me, but I don't believe it has anything to do with Cinemachine.
     
  6. pkumarshall

    pkumarshall

    Joined:
    Aug 3, 2018
    Posts:
    11
    Thanks for all your explanation and suggestions!

    According to my understanding, which may be a misunderstanding, the cause of the reset is that there's two options in animation track, 'Apply Scene Offsets' and 'Apply Transform Offsets'. If we select 'Apply Scene offsets', when the timeline's played, the animation track's binding will inherit its runtime or default world position no matter where. If we select 'Apply Transform Offsets', when the timeline's played, the animation track's binding will be set to a specific point (please see the image#1 of my previous reply). When we jump out of timeline editing, the animation track's binding will be reset to its own scene position, so it seems that if we can adjust transform position/rotation in Cinemachine Track, it will be more efficient to make a cut scene.

    Is it possible to add a move/rotate tool button on Cinemachine Track Inspector by customization?
     
  7. marc_tanenbaum

    marc_tanenbaum

    Unity Technologies

    Joined:
    Oct 22, 2014
    Posts:
    637
    Maybe...but again I think this misses the point.

    You're pointing to a problem that – as far as I can see – has nothing to do with Cinemachine. The problem, if I've understood you, is that you're making adjustments to the animation track. And when you jump back to scene view, the offsets are reset. So it's not that Cinemachine needs to be manipulated a certain way...it's that the animation offsets aren't "sticking". I've set up a simple version on my own which I think demonstrates what you'd like to achieve. As you can see in the video, it works fine for me without ever referencing the offsets in the Cinemachine track.



    So your issue, it seems to me, has to do with why your offsets get reset. Cinemachine is a symptom of the issue, but it's not the cause (unless, of course, I've misunderstood!).
     
  8. pkumarshall

    pkumarshall

    Joined:
    Aug 3, 2018
    Posts:
    11
    Hi, sir, please watch my video, which showed different result from yours. It seems some settings may be wrong in my project.
     
  9. marc_tanenbaum

    marc_tanenbaum

    Unity Technologies

    Joined:
    Oct 22, 2014
    Posts:
    637
    OK, again, I'm not a Timeline expert, but it appears to me that the problem is in how you're using Timeline, nothing to do with CM.

    There can be many Timelines in a game, so how does Unity know which one you're controlling at any given moment? The answer is that it uses the Timeline in the Timeline window. As soon as you click off your Timeline GameObject and onto the Cinemachine object, you lose that selection and the character returns to its base state.

    There's a simple workaround to this. If you look in the top right corner of the Timeline window, there's a padlock icon. With the Timeline GameObject selected, click that padlock icon to 'lock' the Timeline window. Everything should now work as you expect.
     

    Attached Files:

    visualed and Gregoryl like this.
  10. pkumarshall

    pkumarshall

    Joined:
    Aug 3, 2018
    Posts:
    11
    That's it !

    You save my day, sir, thanks very much !!
     
    Gregoryl and marc_tanenbaum like this.