Mouse camera input bug

In the documentation, this is supposed to work:

const camera = new BABYLON.ArcRotateCamera('main_camera', 0, 0, 10, BABYLON.Vector3.Zero(), scene);
camera.minZ = 0;
camera.inputs.clear();
camera.inputs.addMouse();
camera.attachControl(canvas, true);

But I get this error: Uncaught TypeError: camera.inputs.addMouse is not a function. Has the API changed or is the documentation outdated?

This should be addPointers() and not addMouse(). @PolygonalSun has this been changed recently ?

@PirateJC would you mind updating the doc ?

Updated! Great catch @sokorototo

1 Like

As far as I know, there haven’t been any changes to either the code or documentation. Maybe it was a copy-paste issue because FreeCamera does have an addMouse function.

1 Like

Ok I “fixed” my “fix.”

aka reverted the change back to normal.

According to this playground, camera.inputs.addPointers(); exists on the ArcRotateCamera. But is not seen in the documentation. Instead we find the camera.inputs.addMouse(); which is undefined and throws an error. I think the documentation should be updated. I think most cameras with mouse input use this input.

@PolygonalSun - Can you advise us here on the exact doc update that’s needed?

@PirateJC , I guess I could simply add this as a remark where you did the change. It is not the same name as it is not meant to handle pointers fully like on the other camera.