Pan not working with Import Mesh

In my project I’m importing a mesh using the SceneLoader.ImportMesh method however this seems to prevent panning in the scene. I’m using the Arc Rotate camera and panning works fine for generic 3d models, but if I import a mesh using ImportMesh as mentioned before, panning no longer works. Is this by design?

Note, I am using the Right-Click/Drag to pan around, and have also use the “CTRL + Left-Click/Drag” method

Here are some examples:

Here panning using the keyboard shortcut does nothing.

Here is another example where the Arc Rotate camera works fine:

If there’s some way to enable this please let me know. I looked through the docs but didn’t see anything regarding this. I only saw mention of this:

By default, panning with an ArcRotateCamera is also possible by using Ctrl + left mouse button. You can use right mouse button instead by setting useCtrlForPanning to false in the attachControl call :

camera.attachControl(canvas, noPreventDefault, useCtrlForPanning);

I tried that as well, but that didn’t make a difference. If I can avoid building my own custom panning logic that would be ideal.

Hello :slight_smile:

It’s not a matter of mesh import, it’s just because in your first example there is in the load callback the line

camera.target = newMeshes[0];

Which sets the camera rotate point to the mesh. Comment it and panning is back :slight_smile:

++
Tricotou

2 Likes

Awesome, thank you! I figured it was something small I was overlooking. Marked as answer.