I’ve got a bit of a strange issue that I’m not sure how to fix really, or what has changed to make this happen. So I’ve updated my game that was using CM 2.6.17 to now using CM 2.9.7, but in doing this, it has changed the behaviour of my virtual camera.
When the Virtual Camera becomes “live”, the rotation of that camera changes completely and throws off where it should be looking. This happens even in the Editor.
Set correctly:
.
Set the priority of the camera to it becomes live:
Rotation is changed from 90 to 76.
This doesn’t happen on the older version in 2.6.17
What is controlling the rotation of the GameCamera object? You are adding a tilt with the CinemachineRecomposer. As an experiment, remove that behaviour. What happens to the camera rotation? Do you have any other behaviours on that GameObject, and do any other scripts attempt to set its rotation?
There shouldn’t be anything rotating the GameCamera - thats kinda the issue. Before we used the recomposer, the camera would move in and out of the board as well, which isn’t what we wanted - so the GameCamera was set a top down view, the TargetGroup would update the position, and the the tilt from the recomposer would give the correct framing angle we wanted to achieve
In the older version of Cinemachine, this works correctly - the camera is set to 90 all the time and it adjusts the postion framing from targetgroup with the tilt applied afterwards. With the latest version, rotation is applied to the GameCamera, which throws everything off.
Not sure if this is the correct and intended use now and something that has been “fixed”, and our use should never have worked.
Instead of starting with the camera to 90 degrees, start with it at 80 or something like that. I’m thinking it might have something to do with gimbal lock. What happens when you try that?
ok - so yeah, trying that does the same thing. no composer on - activate the camera with priority and it gets rotated - even though nothing should be adjusting the rotation
So it comes down to figuring out where the rotation is coming from. There is nothing in the vcam with FramingTransposer and CameraOffset that will rotate the camera - it will simple use the rotation in the transform as-is. So the rotation is coming from somewhere else.
Do you have any scripts that reference the camera?
Do you have any custom behaviours on the camera?
Is the camera’s parent being rotated?
Yeah - that is what I assumed would be the case too - and that is what is confusing about it, as it also does it when not in play mode. All I have to do is set that priority up high so its the active camera on the brain, and GameCamera rotates. So, while there are code references to it - though nothing changes its position - these aren’t running at that point.
For a while, I thought it was something I must be doing in code, but nothing ever touches the GameCamera’s transform. Only the TargetGroup affects it, and its set to position only, not rotation. But then when I was able to replicate it just turning the camera on in Editor, it seemed something different.
Sorry, the target group is the only thing that has any interaction with the GameCamera’s transform. I don’t adjust it in code at all. It is on a separate component yes.
ok, so when the Recomposer is disabled, nothing in CM is touching the vcam’s rotation. It should remain constant at whatever you set it to, whether it’s the active vcam or not.
Too bad you can’t send me the project. You need to find out by elimination what’s going on.