Platforming Code Behaving Strangely

I’m currently working on a 2d platformer game, although I’m using a 3d engine for it’s parallax effects (Trying to recreate how Hollow Knight by team cherry does it). My code for the movement system is behaving in a strange way where if you hold a direction against a wall, the player will stick to a wall instead of sliding down. Here’s my code:

var Moev = pc.createScript('moev');

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

// update code called every frame
Moev.prototype.update = function(dt) {
    
    //Declaring Variable
    var v = this.entity.rigidbody.linearVelocity;
    var right = 0;
    var left = 0;

    //Key Detection
    if (this.app.keyboard.isPressed(pc.KEY_RIGHT)) {
        right = 1;
    } else {
        right = 0;
    }
    if (this.app.keyboard.isPressed(pc.KEY_LEFT)) {
        left = 1;
    } else {
        left = 0;
    }

    var xspd = (right - left) * 3;

    //Setting the Velocity
    v.set(xspd, v.y, v.z);
    this.entity.rigidbody.linearVelocity = v;
};

If anybody could help me with this, I would really appreciate it.

I would change the physics for the player and the wall: PlayCanvas | HTML5 Game Engine

what I did was set the wall’s friction to 0 and used forces instead of using direct velocity

Thanks a lot! I’ll try it.