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. Dismiss Notice

Question Cinemachine Virtual camera goes off and how to stop moving

Discussion in 'Cinemachine' started by chachatouilleuh, May 22, 2022.

  1. chachatouilleuh


    Apr 5, 2021
    Hi there,

    I hope i'll make myself clear enough :

    I'm a student, still learning how to use unity, I made my fps game with the first person controller of the asset store, my main camera is inside the prefab. I scripted something that stops my unity camera from following mouse inputs when reading a static boolean sat by pressing tab. Everything was working fine until in production process i wanted to add cutscenes.

    I watched plenty tutorials of cinemachine but all of them are always starting their project with a virtual camera and do not use their main camera anymore. I struggled with that because changing camera at this point of production is not always an easy task to do.

    Anyway, my virtual cam is now in my first person camera gameobject and now my problem is that my virtual camera is also following the mouse XY inputs even if I i pressed tab. I have the feeling that the virtual cam is overriding the main (unity) camera.

    Honestly, I don't know how to stop that, I tried to change it by coding something else, or with a freelook camera but idk why, when I'm in play mode my camera is instantly going far away for both of them, i tried to change the distance settings but still not working. I'm lost :confused:

    The effect I want appears to be simple, get my camera standing still when my options are On. It wasn't hard to do with a normal camera, but with a virtual one, I'm not sure to understand how it really works.

    You'll find my scripts, one capture of my editor and and 2 gif illustrating the problem
    anyone can help me ?

    Attached Files:

    Last edited: May 22, 2022
  2. chachatouilleuh


    Apr 5, 2021
    Okay, I found the mistake in my code, I needed to change my condition
    instead of :
    if (!m_isOption || Cutscene.m_isCutscene == false)

    I had to write :
    if (!m_isOption && Cutscene.m_isCutscene == false)

    By the way, I reorganized my hierarchy to get my virtual camera out of the prefab
    Gregoryl and marc_tanenbaum like this.