Cinemachine confinder, how to get current confined mode

Hi,
I’m using Cinemachine Confiner and with my 2D orthographic camera
In order to stop the parallax effect when near the adges I need to know if the Cinemachine is being confined.
I’m looking for something like IsConfinedX and IsConfiedY parameter, Any idea how can I get it?

Hi,
This is not supported currently. We’ll note it as a feature request. If you need to have this information as soon as possible, then send me a direct message.

Also, have you tried using CinemachineConfiner2D instead of CinemachineConfiner - Confine Mode: 2D? (It does not have this feature either)

Thanks for answering
I do use Confine Mode: 2D, still it doesn’t have this feature, I’ll message you :slight_smile:

Why do you need to know this? Can’t you just look at the main camera and always do your parallax effect as a function of its position? When the camera is confined it stops moving.

Sure, this is exactly what I need, the option to know when camera is confined, that’s what I’m asking here, gaborkb told me that this option will be available in the next version as feature request

Yes, but I don’t understand why you need it. Just checking your main camera’s position should be enough to implement parallax without this extra information.

I could do that, but the Cinemachine Confined is already does that and i’m fan of code reuse, especially when using in it in Update()

I don’t see why your code should care whether the camera is confined or not. You can just compute the correct parallax from the current camera placement alone. The code will be the same whether the camera is confined or not, moving or stationary. It makes no difference.

does the camera placement tells me if the X or Y is confined? if so what param is that? I couldn’t find Camera.Placement

I’m talking about Camera.main.transform.position. That’s all you need. Why do you need to know if it’s confined?

You’r right.
Thanks :slight_smile:

1 Like