# Bobomb peaceful-field First Person

**URL:** <https://forum.playcanvas.com/t/bobomb-peaceful-field-first-person/17650>\
**Category:** Help & Support\
**Created:** [February 10, 2021, 11:48pm UTC](https://forum.playcanvas.com/t/bobomb-peaceful-field-first-person/17650 "2021-02-10T23:48:52Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lucious\_Jansma](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/lucious_jansma/32/13748_2.png) [@Lucious\_Jansma](https://forum.playcanvas.com/u/Lucious_Jansma)\
**Post date:** [February 10, 2021, 11:48pm UTC](https://forum.playcanvas.com/t/bobomb-peaceful-field-first-person/17650/1 "2021-02-10T23:48:52Z")

</div>

hey im making a mario 64 bobomb battlefield but its after the battle so I want it to have toads and maybe even little missions but I need to know how to make my guy jump so I hope I can get some help with my game thanks

---

<div class="post-metadata">

**Author:** ![Leonidas](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/leonidas/32/6495_2.png) [@Leonidas](https://forum.playcanvas.com/u/Leonidas)\
**Post date:** [February 11, 2021, 8:32am UTC](https://forum.playcanvas.com/t/bobomb-peaceful-field-first-person/17650/2 "2021-02-11T08:32:00Z")

</div>

Hi @Lucious_Jansma,

Check this post on jumping:

> [@How can I make my character jump?](https://forum.playcanvas.com/t/how-can-i-make-my-character-jump/11067/2):
>
> 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.app…

Make sure to use the forum search function, there is plenty of material that can help you out.

---

<div class="post-metadata">

**Author:** ![Lucious\_Jansma](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/lucious_jansma/32/13748_2.png) [@Lucious\_Jansma](https://forum.playcanvas.com/u/Lucious_Jansma)\
**Post date:** [February 23, 2021, 10:22pm UTC](https://forum.playcanvas.com/t/bobomb-peaceful-field-first-person/17650/3 "2021-02-23T22:22:23Z")

</div>

hey when i insert the script is there anything i need to change???

---

<div class="post-metadata">

**Author:** ![Leonidas](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/leonidas/32/6495_2.png) [@Leonidas](https://forum.playcanvas.com/u/Leonidas)\
**Post date:** [February 23, 2021, 10:25pm UTC](https://forum.playcanvas.com/t/bobomb-peaceful-field-first-person/17650/4 "2021-02-23T22:25:17Z")

</div>

You are making me have dejavu, didn’t we have this conversation today again? 🙂

> [@\[SOLVED\] How To Make Script That Allows Player To Jump?](https://forum.playcanvas.com/t/how-to-make-script-that-allows-player-to-jump/14415/17):
>
> Try increasing the impulse value to something bigger, like 100 or 1000, the body has a big mass. If that doesn’t work, try posting a sample project to take a look why it doesn’t work for you.

---

<div class="post-metadata">

**Author:** ![Lucious\_Jansma](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/lucious_jansma/32/13748_2.png) [@Lucious\_Jansma](https://forum.playcanvas.com/u/Lucious_Jansma)\
**Post date:** [February 23, 2021, 10:28pm UTC](https://forum.playcanvas.com/t/bobomb-peaceful-field-first-person/17650/5 "2021-02-23T22:28:14Z")

</div>

ok sorry im just so confused do you think you could join my project to help me with the jump script mabye but its fine if you dont want to

---

<div class="post-metadata">

**Author:** ![Leonidas](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/leonidas/32/6495_2.png) [@Leonidas](https://forum.playcanvas.com/u/Leonidas)\
**Post date:** [February 23, 2021, 10:31pm UTC](https://forum.playcanvas.com/t/bobomb-peaceful-field-first-person/17650/6 "2021-02-23T22:31:04Z")

</div>

I am away from my desk for tonight, but yes, add me (leonidas) and I’ll take a look tomorrow.

---

<div class="post-metadata">

**Author:** ![Lucious\_Jansma](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/lucious_jansma/32/13748_2.png) [@Lucious\_Jansma](https://forum.playcanvas.com/u/Lucious_Jansma)\
**Post date:** [February 23, 2021, 10:31pm UTC](https://forum.playcanvas.com/t/bobomb-peaceful-field-first-person/17650/7 "2021-02-23T22:31:25Z")

</div>

i did thank you thank you thank you.  
and now for the hard part.  
patience

---

<div class="post-metadata">

**Author:** ![Leonidas](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/leonidas/32/6495_2.png) [@Leonidas](https://forum.playcanvas.com/u/Leonidas)\
**Post date:** [February 24, 2021, 11:37am UTC](https://forum.playcanvas.com/t/bobomb-peaceful-field-first-person/17650/8 "2021-02-24T11:37:53Z")

</div>

Hey @Lucious_Jansma,

I had a quick look through your project, so the issue was the jump script you had in place was empty. You create a Jump script but there was no code in the script methods.

I’ve added the following code in the update method and now jumping works:

```javascript
Jump.prototype.update = function(dt) {
    if (this.app.keyboard.wasPressed(pc.KEY_SPACE)) {
        this.entity.rigidbody.applyImpulse(0, 1000, 0);
    }    
};

```

---

<div class="post-metadata">

**Author:** ![Lucious\_Jansma](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/lucious_jansma/32/13748_2.png) [@Lucious\_Jansma](https://forum.playcanvas.com/u/Lucious_Jansma)\
**Post date:** [February 24, 2021, 12:54pm UTC](https://forum.playcanvas.com/t/bobomb-peaceful-field-first-person/17650/9 "2021-02-24T12:54:52Z")

</div>

ohhh thank you my fault

---

<div class="post-metadata">

**Author:** ![Lucious\_Jansma](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/lucious_jansma/32/13748_2.png) [@Lucious\_Jansma](https://forum.playcanvas.com/u/Lucious_Jansma)\
**Post date:** [February 24, 2021, 1:06pm UTC](https://forum.playcanvas.com/t/bobomb-peaceful-field-first-person/17650/10 "2021-02-24T13:06:55Z")

</div>

what about the jump limit because i can jump indefinetly

---

<div class="post-metadata">

**Author:** ![Leonidas](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/leonidas/32/6495_2.png) [@Leonidas](https://forum.playcanvas.com/u/Leonidas)\
**Post date:** [February 24, 2021, 1:37pm UTC](https://forum.playcanvas.com/t/bobomb-peaceful-field-first-person/17650/11 "2021-02-24T13:37:58Z")

</div>

You will have to enforce a rule to not allow jumping when your player is airborne. The proper way of doing this would be to do a raycast downwards for each frame and detect when your player is on the ground.

Allow jumping only when the player body touches the ground.

---

<div class="post-metadata">

**Author:** ![Lucious\_Jansma](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/lucious_jansma/32/13748_2.png) [@Lucious\_Jansma](https://forum.playcanvas.com/u/Lucious_Jansma)\
**Post date:** [February 24, 2021, 1:41pm UTC](https://forum.playcanvas.com/t/bobomb-peaceful-field-first-person/17650/12 "2021-02-24T13:41:51Z")

</div>

where do i find that?

---

<div class="post-metadata">

**Author:** ![Leonidas](https://forum.playcanvas.com/user_avatar/forum.playcanvas.com/leonidas/32/6495_2.png) [@Leonidas](https://forum.playcanvas.com/u/Leonidas)\
**Post date:** [February 24, 2021, 1:42pm UTC](https://forum.playcanvas.com/t/bobomb-peaceful-field-first-person/17650/13 "2021-02-24T13:42:38Z")

</div>

You will have to code it, study some tutorials or example project that implement raycast on how it works.

Here are some:

[https://developer.playcanvas.com/en/tutorials/?tags=raycast](https://developer.playcanvas.com/en/tutorials/?tags=raycast)
