shadow.autoCalcDepthBounds will affect the flight speed of the fly camera

I found that autoCalcDepthBounds affects the attachControl of the camera.

The precondition for reproducing this bug is to toggle the camera once.

Press V to toggle the camera. → Babylon.js Playground - #JNVF8X#7

Here is the situation in my project:

cc @Evgeni_Popov

How to see the difference of speed in your PG?

At first, nothing is displayed. When I click “V” I can see the plane and move with QWSD, but I can’t see the speed when it works/doesn’t work.

Modify this, then run it and press V to switch to the FlyCamera view. Then move. The value of this property gives the flyCamera different speeds.

Thanks for the report!

I was able to reproduce the issue. The problem was that internal render-target/depth rendering could temporarily switch scene.activeCamera, which fired scene.onActiveCameraChanged. In your playground, that observer detaches and reattaches camera controls, so enabling autoCalcDepthBounds caused the FlyCamera controls to be churned during rendering.

I opened a fix here: Prevent render target camera swaps from notifying active camera observers by Popov72 · Pull Request #18500 · BabylonJS/Babylon.js · GitHub

The fix keeps those internal render-target camera swaps from notifying onActiveCameraChanged, matching the existing internal scene-camera rendering behavior.