Ortho camera crashes with `camera.zoomToMouseLocation = true`

I have an ortho camera but I want to have zoom to centre behaviour like many CAD packages (OnShape as an example). I spied the new zoomToMouseLocation in 5.0.0-alpha so thought I would try it out, but it causes this example to throw an error in the console and crash the camera (it gets stuck in position, no inputs can rescue it)

https://www.babylonjs-playground.com/#KUM5WC#63 (pan to cause the behavior)

I’m also guessing that it’s possibly unlikely to work out of the box for the orthocamera because we need to do pretty manual things to do scrolling with the orthocamera?

You should set the zoomToMouseLocation property before calling attachControl so that it does not crash.

However, I don’t know if this feature is supposed to work with orthographic cameras… Maybe @clovett will know as he did the PR to add the feature.

1 Like

Based on what I’m seeing, I think that there may be an issue with how zoomToMouseLocation works with the ortho camera.

@clovett could you have a look into it?

sure, I’ll take a look.

2 Likes

Hey @clovett did you find time to take a look ?

This will be fixed in the next nightly