Search Unity

Cinemachine Confiner With Group Composer

Discussion in 'Cinemachine' started by RemDust, Mar 19, 2018.

  1. RemDust

    RemDust

    Joined:
    Aug 28, 2015
    Posts:
    432
    Hi there,
    I'm having a really hard time configuring the confiner for my orthographic v-camera.

    My problem is basically that I can't manage to make the "Look At - Group Composer" work along with the Cinemachine Confiner...

    - The confiner works fine if I'm following a single target
    - The group composer works fine without confiner

    When I try to setup both, I sendup with a distorted screen and a camera that doesn't seem to be constrain as intended...

    I think one of the issue is the camera is allowed to rotate to "look at" targets when i'd like it to be "rotation locked".

    Do you guys have any idea how to setup that properly ?

    Thank you all :)
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,719
    If you want it to be rotation locked then you have to put "Do Nothing" in the Aim section of the vcam. The job of Aim is to rotate the camera.

    Try using the Framing Transposer in the Body section. Put your group as the Follow target.
     
    Exceeds likes this.
  3. RemDust

    RemDust

    Joined:
    Aug 28, 2015
    Posts:
    432
    Ok, I'm a noob, and it's now MUCH better ^^
    However, I'm now trying to find a way to have a "default view" and to switch towards the "follow zoom group" behavior.
    I thought it would be pretty easy to have another target in the group always at the center of my scene and to lower players weights to recenter the Vcam : however if I do this the camera does get the center but the zoom functions doesn't play anymore : I keep the orthographic size I had before I "reset" my camera with weights...

    I thought then that I could play with my "center object" target radius (from the group center script) and even if it seems to work and get me the orthographic size that I want, it looks like the radius setting is messing up the camera behavior even if the target weight is set to zero, I would have expected the camera to ignore the radius target if the target weight is null, right ?

    I guess my chance now is to use 2 Vcam and switch from the default one to the "cool one" when I want
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,719
    Yes, use the #1 rule of Cinemachine: don't try to do it all with one vcam.
    Set up 2 vcams, enable the special one when you need it and CM will blend to it from the first vcam. When you disable it, CM will blend back.
     
    Exceeds and RemDust like this.
  5. RemDust

    RemDust

    Joined:
    Aug 28, 2015
    Posts:
    432
    Thank you for answering so quick !
    Vcams really look like a lot of fun :)

    It's so nice experimenting with it !
     
  6. RemDust

    RemDust

    Joined:
    Aug 28, 2015
    Posts:
    432
    Maybe you can also help me with some runtime issues :
    It seems like I can't find how to access some classes relative to Cinemachine.
    Right now I'd like to set at runtime some targets in the target group and modify their weights but I don't know how to access them :/
     
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,719
    CinemachineVirtualCamera and CinemachineTargetGroup are just ordinary GameObject Components. Use GetComponent<> to get them, and you can manipulate any of the public members, like LookAt or Follow.

    In the case of the target group, there is an array of members. Manipulate it as you would any c# array field of a class.

    If you want to access some of the subcomponents of the vcam (such as the Framing Transposer, or the Noise component), then there is an extra step. Those are not ordinary components. You would access them by writing for example:
    var framing = vcam.GetCinemachineComponent<CinemachineFramingTransposer>();
    framing.bla = bla
     
    Exceeds and RemDust like this.