I tried to add jumping in the first person controller with applyImpulse and it worked but it can also jump when its not on the ground so if you press space very fast you can go as high as you want. Is there some sort of line with wait or that you can only jump when your character is on the ground?
I am not sure if this would work, but you could try doing an if statement to check if the character has reached a certain height. If it has not, then let it jump, otherwise you can keep it on the ground.
Something like -
if (this.entity.getPosition().y < //maximum height)
{//jump}
You’re welcome. @EsterZ, can you make a basic space shooter game for my project? It’s pretty urgent and I need to find a team member, since I need to work on something else. I will give all due credit to you. Please let me know if you are interested.
Using pos.y for “can jump detection” prevents you from making any kind of nice vertical maps. The height difference in maps is often what makes them attractive, in e.g. FPS shooters. Climbing up the ladders, jump over gaps, walking downhill etc.
I am using this script:
Ground detection is based on Ammo.js Capsule collision and you can only jump once every 500ms
It’s not perfect yet, but I think we need to collaborate more on “this kind of stuff should just work” essentials.
If you have any ideas or actual code to improve the script, just write here please