How to make three.js orbit controls like camera controls

In three.js orbit controls( three.js examples ) it’s like ArcRotateCamera when looking round with mouse but if we pan around the behavior changes to something like UniversalCamera, so whanted to know if there is a way to get something like three.js orbit controls with UniversalCamera or ArcRotateCamera

It’s exactly the same as ArcRotateCamera, isn’t it?

it’s same as ArcRotateCamera until you try to move with arrow keys instead rotating around a the target it pans the scene like in UniversalCamera , you can try using the arrow keys on both exam examples three.js examples ,

you should probably look at this:

@Subrat_Gupta yup in Babylon panning is ctrl + the direction keyz

@PolygonalSun any quick customization tricks ?

If I’m understanding this correctly, it kinda looks like you’re trying to have an ArcRotateCamera that uses mapPanning (panning only on X/Z axis). If that’s the case, all that you need to do is, while using an ArcRotateCamera, just set the camera’s mapPanning flag to true. That should give you the desired behavior while panning.

For the UniversalCamera, nothing immediate comes to mind as all movement is done using FreeCamera inputs (which make all movements with respect to the camera’s direction/local space). That might require custom controls. You could also just remove the standard controls and directly add to the camera’s movement vector (cameraDirection) and just leave the y element at 0.

1 Like