How can I increase the speed at which the camera zooms when using the scroll wheel?

Hi, I’ve just started trying to figure out babylonjs and i have a cube and sphere rendering, when i use the mousewheel the camera zooms in and out but it’s really slow, like, to the point where it isn’t useable, here’s my camera code…

this.freecamera = new FollowCamera('camera1', new Vector3(0, 10, -10), this.scene);

this.freecamera.lockedTarget = this.playermodel;
this.freecamera.radius = -150;
this.freecamera.heightOffset = 40;
this.freecamera.fov = 20;

// attach the camera to the canvas
this.freecamera.attachControl(this.canvas, false);

when i tried to look for answers online i saw a lot of mention of “wheelPrecision” but that property doesn’t exist on the camera so maybe it’s deprecated? is there a setting i’m missing? the speed setting doesn’t do anything (except maybe make the initial positioning of the camera faster), any help will be appreciated :slight_smile:

Pinging @msDestiny14 to see if she has some cycles to help

1 Like

Here is the link the babylon docs for camera.

There is wheelDeltaPercentage as well as wheelPrecision and examples in playground are attached to each. :smiley:

Here is another reference regarding gliding camera: Gliding camera drift


Hey @erin_collective and @msDestiny14…welcome to the Babylon family! We’re sincerely honored to have you here!



Digging deeper on this. @erin_collective you can actually get wheelPrecision from the input on the camera!

Here’s an example: this.freecamera.inputs.attached.mousewheel.wheelPrecision = 5;

1 Like

Hello @erin_collective

Adding the line below will adjust camera zoom speed:

camera.wheelPrecision = 0.5; //Mouse wheel speed

I think this is basically the same as what @msDestiny14 already provided.

Here’s a PG where you can adjust that value:

1 Like

hi, thanks for the help, I had actually tried both of those before i came here to ask for help lol, here ais a screenshot of what i get, same thing with both suggestions, also, testing in game having these lines there makes no difference to the zoom speed on mousewheel.

you need to cast it to any:
(this.freecamera.inputs.attached.mousewheel as any).wheelPrecision = 0.5 for TS to compile

this works, thanks!

1 Like