Losing jump power

why sometimes my jumping power is lost and it takes a few seconds to be able to high jump again is something wrong with my script or from the entity?

Hi @Dann,

Can you share your scene setup and your jumping code?

var PlayerMovement = pc.createScript('playerMovement');
var onground = false;

PlayerMovement.prototype.initialize = function () {
this.entity.collision.on('collisionstart',function(result){
        if(result.other.tags.has('ground')){
            onground = true;
        }
    },this);
};

PlayerMovement.prototype.update = function (dt) {
 if (app.keyboard.isPressed(pc.KEY_SPACE) && onground) {
        this.entity.rigidbody.applyImpulse(0,30,0);
        onground = false;
    }
};

Can you try and debug the onground value if it’s always set to true, when you try to jump?

it still not working. please check my project https://playcanvas.com/editor/scene/1018463 and try to debug then long press the space key

Actually, I wasn’t able to reproduce the issue. I could make the character jump with no issue all the times. Could you sent a video when the issue happens?

when reloading the web its high jump like at the end of the video

You seem to be using isPressed over wasPressed, is there a reason for this?

I don’t think so, before I haven’t added the jump script and when the character falls it will fall slowly a few seconds then it will return to normal after a few seconds.