How can I make my character jump?

i have a question, ¿how I can make my character jump?please

1 Like

You have to attach a script & make sure the player has a rigidbody & collision component attached to it. Make sure the rigidbody is type Dynamic. Then code a script similar to this:

//Variables
var force = 600; //You can change the value if you want.

NewScript.prototype.initialize = function() {
    this.app.keyboard.on(pc.EVENT_KEYDOWN, this.onKeyDown, this);
};

NewScript.prototype.update = function(dt) {
    if (this.app.keyboard.wasPressed(pc.KEY_SPACE)) {
        this.entity.rigidbody.applyImpulse(0, force, 0);
    }
};
1 Like

does this still work?

Hi @Logan_Ketler! Yes, this still works.

This wont work in my game

it jumps but you can jump in the airjump code