[SOLVED] How to make the key to be left click on a mouse

var SlowMo = pc.createScript('slowMo');

// initialize code called once per entity
SlowMo.prototype.initialize = function() {
    
};

// update code called every frame
SlowMo.prototype.update = function(dt) {
    if(this.app.keyboard.isPressed(pc.MOUSEBUTTON_RIGHT)){
        this.app.timeScale = 0.4;
    } else {
        this.app.timeScale = 1;
    }
};

// swap method called for script hot-reloading
// inherit your script state here
// SlowMo.prototype.swap = function(old) { };

// to learn more about script anatomy, please read:
// http://developer.playcanvas.com/en/user-manual/scripting/

I want the key E to be left click on the mouse. How do I do this?

Sorry, what are you asking here?

so, currently, you press E to slow down time, but I want to make it where you Press right click on the mouse to slow down time. How is this done?

I think the topic below can help you with that.

3 Likes

thanks. :smile:

2 Likes