Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

multiple raw pos for one vcam possible?

Discussion in 'Cinemachine' started by Brainslum, Apr 5, 2018.

  1. Brainslum

    Brainslum

    Joined:
    Jan 10, 2017
    Posts:
    54
    hi
    we are trying to re implement our old camera system in cinemachine. it was like:
    1 gameobject controlled by a camera path.
    It has a child go, which is the crane controlled by WASD.
    the crane go then has another child GO that controls the actual camera, which we used an asset to control. asset is called camera controller by ottii.

    how should we approach to this with cinemachine or should we port our existimg stuff as an external vcam? however we still want to do lots of transition and every camera needs to be this way. every external vcam we need to have a unique pos. in this case we need 3 gameobjects+ 1vcam for every cameraman which is not really nice...

    based on my underatanding camerastate can only take in 2 values. 1 is saved for extension which we want to save for collider detection. so we have no idea how to jam 3 transform factors into rawpos(we are thinking of outputing one rawpos based on 3 transform calculation but not sure what is the best way to implement code)
    pls shed some lights!



    thanks!
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,208
    Cinemachine is designed to play nicely with existing camera controllers. If you have some camera controllers that are working for you and you just want to add cool CM stuff like transitions, collision, noise, etc, then it is very easy to do.

    Let's say you have a complex controller, with the camera buried inside it somewhere, like you described. Here is what you should do: inside your rig, find the GameObject with the Camera component. Remove the Camera component and replace it with a CinemachneVirtualCamera component. Set the Aim and Body both to "Do Nothing". So now your rig controls a vcam instead of a Camera.

    Next, create a Main Camera as a standalone GameObject, at the root. Give it a CinemachineBrain component. Now that camera will be puppeteered by the vcam.

    Create as many vcams as you like. The most-recently-activated one with the highest priority will have control over the main camera. Transitions, Timeline clips, etc will all work. You can add noise, Collision avoidance, whatever, to the vcams.

    It's a good idea also to set the LookAt targets on your vcams. This will give you better quality blends, because the system will know what the camera wants to look at.
     
  3. Brainslum

    Brainslum

    Joined:
    Jan 10, 2017
    Posts:
    54
    thanks so much! we thought external cam was the way to go. However here are another 2 questions:
    1. should I control the Crane of the camera with a Donothing Vcam Also? And should I use camera blend/camera state for the three level GO structure described in the text and in the pic below?

    Here is an image explanation. I wanted the most scalable way to solve this issue in the future. So I am fine with migrating my code into a new inherited vCam or Camera Blend if necessasry.


    2. speaking of migrating code, what is the best place to put Camera control code within cinemachine?

    Thanks so much!!
     
  4. Brainslum

    Brainslum

    Joined:
    Jan 10, 2017
    Posts:
    54
    ugh looks like the pic died. here is the final try to upload... but its just a pic mockup of the text description
     

    Attached Files:

  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,208
    If your camera code is working, there is no need to change it at all. Just replace the Unity Camera with a vcam DoNothing, as follows:

    upload_2018-4-9_16-7-44.png

    The Unity Camera will be automatically puppeteered by the vcam. To transition to another vcam, just create one and enable it. The vcam should never have vcam children. The vcam is a node that drives the Unity Camera. It makes no sense to nest them.
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,208
    Sorry, I don't understand this question. Can you elaborate a little on what you're trying to do?