Babylon.js and MapTiler where assigning a gizmo to an object blocks camera rotation with the mouse and causes unexpected behavior when moving along the Z-axis

playground - maptiler with babylon - JSFiddle - Code Playground

Recently I decided to use babylon together with maptiler and ran into a problem that when I want to assign a gizmo to an object and when attachControl is set, I am blocked from rotating the camera with the mouse and I can only rotate it using buttons. also when moving the blue (Z) vector it either increases or decreases the gizmo

cc @amoebachant

Hi @Artem_Ogurec welcome to the forum

That vector changes the Z position of the box. With the current camera orientation, it means moving the box closer or away from the camera.

freezeProjectionMatrixfreezes the projection matrix but in the code, the view matrix is multiplied and injected in the projection.
I guess you want maptiler to have control on camera and inject that camera in Babylon.js. To do so, you’ll have to get both view and projection matrix.
Then get position/orientation using Babylon.js docs
Inject projection matrix and rendering should be in sync.

Concerning the gizmo inputs, I don’t know if it’s possible to catch the events when using the gizmo and forward the events to maptiler in case gizmo is not being used. And I’m not sure letting Babylon.js handle inputs events will be helpful here because of UI.

1 Like