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 Need help with Cinemachine Confiner in 3d

Discussion in 'Cinemachine' started by Clydey2Times, Jul 8, 2023.

  1. Clydey2Times

    Clydey2Times

    Joined:
    Oct 24, 2017
    Posts:
    232
    I can't get the main camera associated with the virtual camera to remain within the bounding box I've set in the confiner extension.

    The virtual camera correctly stays within the box, but the main camera keeps moving independently and follows the player even after the vcam has stopped following. Can anyone tell me what I'm doing wrong? Is there a setting I've missed within the main camera? Very much at a loss here, so help is greatly appreciated.

    I'm using the framing transposer body, by the way.
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,233
    Do you have more than one vcam in your scene?
     
  3. Clydey2Times

    Clydey2Times

    Joined:
    Oct 24, 2017
    Posts:
    232
    Yes, I have 3. All using the same bounding box. Does that affect it in some way?

    Here's a couple of images to illustrate what's happening. You can see the main camera keeps going after the vcam hits the edge of the bounding box.

    cinemachine1.png cinemachine2.png
     
    Last edited: Jul 8, 2023
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,233
    I don't see the issue from your images. Looks like the main camera (the white icon) is closer to the subject than the CM icon (the red one). I presume that's because it's being confined. Note that the CM transform will not reflect the confined state - it shows you where the camera would be if not confined.

    I asked about multiple vcams because I thought that maybe another vcam was active and driving the main camera.
     
  5. Clydey2Times

    Clydey2Times

    Joined:
    Oct 24, 2017
    Posts:
    232
    The issue is that the confinement doesn't seem to be working. The camera is rendering as though it isn't being confined. Although the main camera is stopping when it hits the edge of the bounding box, the CM keeps tracking the player and that is what's being displayed in the game view.

    The fact that the main camera is being confined doesn't seem to matter at all. The game view continues to show what is happening from the virtual camera's perspective. Do you have any idea how to fix this?
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,233
    Do you by any chance have a Camera component on the vcam? If so, remove it. The only Camera component should be the main camera, with the CM brain. The vcams puppetteer that.
     
  7. Clydey2Times

    Clydey2Times

    Joined:
    Oct 24, 2017
    Posts:
    232
    That's it. You nailed it. Thank you so much. I have no idea why there was a camera component on the vcam.
     
    Gregoryl likes this.