Mouse wheel in editor

I’m on Windows 7 using a Naga Hex Razer mouse. When in the editor trying to zoom/dolly the camera, the mouse wheel has very little effect on the amount of change to the camera when in perspective view (orthographic views are fine). I have to go through dozens of revolutions of the mouse wheel to get anywhere. Is there any other way to zoom/dolly the camera? Maybe holding shift while rolling the mouse wheel could double the amount of movement or something?

If you press f to center the camera on different objects you may be able to manipulate the camera more easily.

Since I’m procrastinating the pewdiepie AND the playhack jams I figured out how to do what you requested.

Using chrome press f12 to open the dev console then go to playcanvas.com/script/designer_camera.js

Scroll down to line 180 and change it so it looks like this:
DesignerCamera.prototype.dolly = function (distance) {
this.recordUndoablePosition();
//double zoom if shift is pressed
var zoomrate = 2.5;

    if(this.shiftPressed){
        zoomrate = 10;
    }
    console.log(zoomrate);
    // Dolly along the Z axis of the camera's local transform
    var factor = distance * zoomrate;

Then also go to 259 and change it so it looks like this:

DesignerCamera.prototype.onMouseWheel = function (event) {

    if(event.shiftKey){
        this.shiftPressed=true;
    } else {
        this.shiftPressed=false;
    }
    
    switch (this.entity.camera.projection) {
        case pc.scene.Projection.ORTHOGRAPHIC:
            var delta = event.wheel * 10;
            this.updateViewWindow(delta);
            break;
        case pc.scene.Projection.PERSPECTIVE:
            this.dolly(event.wheel);
            break;
        default:
            break;
    }
};

Then press control s and you’re off!

If I can cook up a userscript for you in the next 10 min I will but it’s a bit tricky.

1 Like

Thanks for pointing out the relevant code! Very helpful.

I got addicted to making this, so here you go :slight_smile:

https://monkeyguts.com/code.php?id=613

Updated the script. Added exclude rules so the script doesn’t run in play mode (was getting errors).