I need help for a jumping script maybe a tutorial

iv’e tried multiple codes but they don’t work.

Hi @genre! What kind of game do you make? Third person or first person? Dynamic rigidbody or kinematic rigidbody?

Hi @genre,

You can check out this thread on how to make a character jump - How can I make my character jump?

im making a first person game iv’e handled at least walking and respawn if i fall off the map, im new to coding so im wondering on multiple things like running, jumping, sliding and gun models\codes iv’e spent at least 3 days on the walking.

Very good! If you use a dynamic rigidbody for your character, the way @DevilZ shared above can help you.

yes i did use dynamic rigidbody

ask him to help me?

because i looked at the thread but i didn’t really understand the code and i dont known how to do that kind.

Can you share your project please, then I can try to assist you.


You can try to add the code below inside the update function of your firstPersonMovement script. You can adjust the force value to get the right result.

    var force = 500;
    if (this.app.keyboard.wasPressed(pc.KEY_SPACE)) {
        this.entity.rigidbody.applyImpulse(0, force, 0);

did i add it right? @Albertos

like i said im new to coding iv’e started learning 1 week ago

You did it right. You just have to save your script to apply the changes.

i saved it but i cant jump or is my force wrong?

I see there is already a force variable defined. So we have to change the name of the variable. The current force can also a little higher I guess.

    var jumpForce = 1000;
    if (this.app.keyboard.wasPressed(pc.KEY_SPACE)) {
        this.entity.rigidbody.applyImpulse(0, jumpForce, 0);


Yes, that’s right, but I think you accidentally deleted the line below from the original script, so you need to place it back.

   var force = this.force;

ok it worked but do u know how to make it not infinite jump.

yeah i think i messed it up because its falling slowly and jumping infinintly.