Simplest way to get nice rotation behaviour a la ArcRotateCamera on a mesh

Hi all, I have a simple scene with a few objects, lights, etc, and an ArcRotateCamera that I can drag around to look at things from different angles. But really I want to pick one of the meshes at a time and rotate that, have other controls to switch the camera between targets, and just allow the camera controls for zooming.

Now I can do the first and trickiest part of that by watching pointermove events and creating a rotation from the accumulating X and Y movements of the mouse pointer, but this presents some issues: touch events seem to have a different scaling than mouse events, the rotation is not smoothed for me, and if I re-orient the camera through some other means then the rotation is wrong and must be transformed by the camera’s rotation matrix in some way I haven’t yet worked out how to do.

Is there a simple way to get all these niceties on a mesh: smoothing, harmonious touch events, accounting for the view orientation, etc?

With that done, what is the simplest way to leave the camera able to zoom, i.e. respond to pinch and scroll events, but without its other behaviours?


Would those not do the trick : Mesh Behaviors | Babylon.js Documentation ?

They can help manipulating meshes.

Possibly, but I didn’t see a way to disable the translational behaviour of the SixDofDragBehaviour - and indeed the example only seems to have translational (I can’t work out how to rotate the mesh without the use of the gizmo, and I don’t want to force the user to click on bits of a gizmo to perform the rotation) - is this buried somewhere? Or did you mean one of the other behaviours?

Yup there are no simple ways to do it. @Cedric might have a trick.

I can think of a quick way to do rotation smoothing. instead of setting the target angle, do a slerp interpolation between the current quaternion and the targeted quaternion.
do not interpolation angles because of periodicity. I do this kind of interpolation a lot.
You can also do that on positions or any other value.