Hello, I'm a total beginner in game development and I'm trying to create my own 3D game with third person character movement, but I don't know how to limit jumping. I followed Brackeys first person movement video, and I have checked if everything is right with the codes and placement, and tried to see in the comments if anyone has a solution to this. However, nothing has worked. So I came to this server to see if anyone here can help me, and that would be so kind:)
#Limit jumping
1 messages · Page 1 of 1 (latest)
Define "limit jumping".
Do you mean that you only want the character to be able to jump when grounded?
Or only jump up to a certain height?
And if you have code already, it's usually for the best if you show your code and describe what you expect it to do, and what it actually does. That's often the best way to get help with programming.
With limit jump I mean I want the character to only be able to jump one time and then land on the ground again. Not multiple times while in air. Here is the code, but its not quite the same as in the video because I have added some things and made some adjustments. However the jump is the same and its not working?
here is the script
I don't see anything inherently wrong with the jumping code.
However, the ground check Brackeys implements in that tutorial is completely pointless; The CharacterController class already has a ground check built-in, both via its isGrounded and collisionFlags properties. You can simply check those; relying on Physics.CheckSphere in this context is redundant.
oh ok, so can I then just delete that line or write in something else?
you can just remove your own isGrounded variable and replace "isGrounded" with "controller.isGrounded" everywhere else.
Ok so it seems to kinda work, but it doesn't jump right away when I press the jump button. I have to press multiple times in order to get one jump and then have to press jump again multiple times to jump again?
Nevermind I think its because my character is in the ground😅 let me just quickly fix this
I dont know how to fix that either😅
My character is half way through the ground, but both the character and ground has collider on
The character model sticking in the ground is often caused by badly set up animations.
But it doesn't have animations? Its just a capsule right know
Then I don't know how you managed to clip into the ground halfway...
me neither😅
Does your character by any chance happen to have both a Rigidbody and a CharacterController arrached?
The character doesnt have rigidbody, but it has charactercontroller
I fixed the ground problem, but I still have to press jump multiple times in order to jump
I can jump fine when standing, but not when walking
It jitters/shakes a lot though when the character walks, so maybe something happens with the collisions?