FramingTransposer Perspective Camera Issues

Hello! I’ve been trying to use the Cinemachine Framing Transposer to track a Target group that will consist of two playable characters, but I noticed that when the camera is not set at a right angle the bounding box calculations are quite off.

To illustrate the problem I’ve set up two targets in a group with a overhead camera at 90 degrees.
You can see a nice an tight bounding box which is the desired effect.

When testing with a any other camera angle than a straight angle I see that the calculation is quite a bit off.

Becoming even worse when the distance between the targets is bigger, with the calculation favouring the objects further away.

I started digging in to creating a custom framing transposed based off the default one and was able to find ComputeGroupBounds, and in there the code that fixes the positioning of the camera for perspective camera, also causes the bad re-calculation of the bounding box.

When removed the bounding box is better - I wouldn’t say correct cause the positioning is not adjusted.
But here is the result.

I don’t fully understand the math that is calculated in GetScreenSpaceGroupBoundingBox to be able to modify it but it would be great if you guys considered supporting angled camera views with Framing Transposer as it would really help in top down games.

I’m aware that the documentation specifically states that the Framing Transposer is meant to look at a straight angle.

With Orthographic cameras the transposer behaves properly, with tight bounding box around objects.

1 Like

Thank you for brining this up. It’s a tricky problem, but probably solvable. We will add it to our list.

Update: we have a fix for this. PR is in flight. Should be included with the next CM release.

Thanks @Gregoryl , that’s great! Will give it a go when it’s updated in the package.

1 Like

Hey @Gregoryl ,
I’ve been checking out the last few updates to Cinemachine looking at the changes to above issue.
I’ve recorded a quick video to show the behaviour I’m still seeing, in some cases it does now work, but at some other group arrangements it behaves a bit more uncontrolled.

If there is anything else you’d like me to send to debug this issue please let me know, hope that helps a bit to show what the issue is.

I can’t see the video

Ah, sorry should be ok now, selected wrong permissions ;(

Sorry for the long delay, I was on vacation.
I can see the video now. Interesting!
Can you send me the project?

Hi Gregoryl,
I’ll make a small repro project next weekend and send it over.