@@DenizSimsek That's absolutely fine. But, if may I ask, how would you o about jumping now? Toggling a bool in update so it can trigger the jump in fixed update?
You can move the jump related code, toggling and adding force to the FixedUpdate method. Update can only be used for the movement now. FixedUpdate and Update can be used within a script file at the same time. Their execution time will differ.
@@DenizSimsek my collisionenter is not doing anything whatsoever /: this is the code im using: private void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Ground") { OnGround = true; } }
Thank you for the helpful tutorial:)) For anyone who might have the same issue: it wasn't working for me even though onKeyDown was fine - just had to increase the force, aka the middle number in the Vector3, cause my character model was set to be heavier than the cube in the video:D
Thanks for making this, it worked first time for me. Which is high praise considering that for me most tutorials on youtube don't work the first time for me.
Just saying this, nothing is better than creating a new fresh unity project, knowing that you have around 10 hours for yourself, and make start out in visual studio with all your knowledge!
great this helped me a lot in going to make game in unity called collectables there are various tasks you have to do like search for 3 bottles and 2 cars and etc...
You can fix it by going to the if collision thingie in private void oncollision and then in the if(collision.gameObject.name == "Your ground name") your ground name means whatever you have named your ground as put the name there, done it worked for me after doing that :)
With this method, wouldn't you be able to climb-jump a large cube if it's tagged as ground? Because when you jump towards its side you are colliding with it thus triggering the ground condition. Correct me if I'm wrong.
i aint no pro here, but you could place a invisible plane with tag ground thing and yeah. I realised whilst typing it aint perfect but ill leave it in case it helps
for some reason when I used this code for my player, i could only jump once. I would jump once and then I wouldn't be able to jump again. There were no errors that Unity could find. How do I fix this?
I think I did something wrong, so I followed the tutorial doing the same code as you but I can only jump once and after I land I can’t jump again, what’s happened?
Hey man, thanks for the tutorial, just one question: When setting the variable back to "true" in the OnCollisionEnter() method, for me it does not set back to true. It becomes false when the user has jumped, but when landing it doesn't change back to true. I even checked to see if it the method was working by putting a Debug.Log and the method DOES execute, but the variable doesn't change. Any fix for this?
Great Job with the tutorials! Hopefully you will continue them. Quick question, for example, when you jump on the platform and stay on the edge the player object will "fall" (change z axis rotation) how can i stop that? I added "rb.constraints = RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezePositionZ;" this stops that BUT if i stay on the edge on the platform long enough, then the object will walk on the side of the platform like a spider. How would one edit it, as to make the player "stand" on the edge but not fall, BUT also freeze the axis as to stop the side of the platform from becoming "the floor", i dont know if you understand what i mean.
Thank you very much for your feedback. If I understand it correctly, you want the cube to stay on the edge without falling and not slide from the side of the platform. Right? If it is, I'll try to find a solution tomorrow.
@@DenizSimsek Basically yes, as long as 1 pixel is on the platform, the player wont fall, BUT if it falls, i want the player to stay in the upright position, right now it starts falling and it "lands on the face". I tried with the constraints as i said, but then the side of the platform becomes the new "down" or floor.
Ok I figured it out, to anyone wondering. Under the rigidbody component for the player, theres a little dropdown menu called constraints, tick the boxes for freeze rotation on x y z and now your player objects stays upright! :D
This is a bit wrong as it would refresh your jump even if touch the side of an object named floor it wont refresh the jump if it lands on an object which is not floor. Shouldn't we use raycasts pointing downwards
Even though it is not jumping in the air But when it comes to ground then 'cubeisonground' doesn't checks to true..... due to which it doesn't jump any more.....
Hi I would aprecciate it if you could help I wrote public bool FeetIsGrounded = false; private void OnCollisionEnter(Collision collision) { if(collision.gameObject.tag == "Ground") { FeetIsGrounded = true; Debug.Log("Feet are grounded."); } } but it doesn't work. why?
I'm stuck. I can only jump once. The CubeIsOnTheGround box doesn't check again. Stays unchecked. Edit: Nevermind, fixed it somehow, don't ask me how lol.
i change the name of "cubeisonground" to "playerOnGround" and did everything exacttly the same but it goes bad with my movement and just docent stop jumping, any idea what i might of done wrong?
UnassignedReferenceException: The variable rb of Move has not been assigned. You probably need to assign the rb variable of the Move script in the inspector. UnityEngine.Rigidbody.AddForce (UnityEngine.Vector3 force, UnityEngine.ForceMode mode) (at :0) Move.Update () (at Assets/Move.cs:29)
Hey, I have a problem, the thing is that I can't jump when I jumped, I mean, I can only jump once, after that I can't jump, I know it's because of the position but I don't know how to solve it, help please
Deniz sorry for basically spamming all your vids with ideas but I was wondering if you could do a tutorial on, "WaitForSeconds" and the "IEnumerator" functions.
You don’t need to use Rigid Body with Character Controller, because with that you control the character without physics. With Character Controller you just give a y position to your player when the Jump button pressed down. If you want to keep the Rigid Body and use Character Controller for jumping then you should disable gravity from the Rigid Body, I think.
Isn't it wrong to use physics related stuff inside update?
You are right. The physics related calculations, meaning adding force to a rigid body , should be in the FixedUpdate. My mistake here.
@@DenizSimsek That's absolutely fine. But, if may I ask, how would you o about jumping now? Toggling a bool in update so it can trigger the jump in fixed update?
You can move the jump related code, toggling and adding force to the FixedUpdate method. Update can only be used for the movement now. FixedUpdate and Update can be used within a script file at the same time. Their execution time will differ.
@@DenizSimsek my collisionenter is not doing anything whatsoever /:
this is the code im using:
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == "Ground")
{
OnGround = true;
}
}
@@raik1766 You should use: if (collision.gameObject.CompareTag("Ground")) instead since it's more performent
finally a good turtorial its so hard to find these!!!
I know
Thank you for the helpful tutorial:)) For anyone who might have the same issue: it wasn't working for me even though onKeyDown was fine - just had to increase the force, aka the middle number in the Vector3, cause my character model was set to be heavier than the cube in the video:D
Thanks for making this, it worked first time for me. Which is high praise considering that for me most tutorials on youtube don't work the first time for me.
BRO, i have been searching about this for a long time. But this was the right video for it. Thank you so much
Just saying this, nothing is better than creating a new fresh unity project, knowing that you have around 10 hours for yourself, and make start out in visual studio with all your knowledge!
I am addicted to fresh starts!
@@DenizSimsek I am too and very but i am getting un addicted to it which i think is good
great this helped me a lot in going to make game in unity called collectables there are various tasks you have to do like search for 3 bottles and 2 cars and etc...
Thank you so so so much i've been trying to find a simple explanation of how to jump with a cube in unity and this is the perfect one Thank you!
Thanks a lot after 1 and a half day of watching videos and reading articles finally this worked thanks a lot you made my day
Thank you so much.
I have a question that if i pressed “X” in a PS5 controller, will the character jump? If not, how do i do that?
To do that, look at the ps5 controller mapping for unity. That’s how I found out how to make a player jump in vr!
@@concotime Thank you so much!
“We’ll name his ass……w….w..we’ll name it as” Good video and a good laugh thanks man!
Your english is so fluently. I took an example by you.
I can still only jump once :(
Thanks a ton! I couldn't figure this out, and all the other tutorials broke my movement code, really underrated channel right here.
Let me guess, your movement code is for the Brackeys tutorial
I'm stuck. I can only jump once. The CubeIsOnTheGround box doesn't check again. Stays unchecked
You can fix it by going to the if collision thingie in private void oncollision and then in the if(collision.gameObject.name == "Your ground name") your ground name means whatever you have named your ground as put the name there, done it worked for me after doing that :)
@@X0MB Thanks!!
@@X0MB thanks a lot dude. i had the same problem. Solved it!!!
@@milindbhandari The script doesnt work at all? I cant jump...do you have any tips?
Won't this allow you to jump as long as you're touching a ground object, such as the side?
Why is it so difficult to find such good tutorials?!!
its number 1 if you search unity how to jump 3d
soo for me it was not
Because most of the people are ... you know..
this one is bad trsut me
This was the video I was looking for. Thanksss.
With this method, wouldn't you be able to climb-jump a large cube if it's tagged as ground? Because when you jump towards its side you are colliding with it thus triggering the ground condition. Correct me if I'm wrong.
i aint no pro here, but you could place a invisible plane with tag ground thing and yeah. I realised whilst typing it aint perfect but ill leave it in case it helps
for some reason when I used this code for my player, i could only jump once. I would jump once and then I wouldn't be able to jump again. There were no errors that Unity could find. How do I fix this?
Are you sure that EVERY piece of cube or whatever your ground is is tagged as Ground?
same thing is happening to me
just figured it out, my void OnCollisionEnter was not was indented. Make sure it isn't indented into the void update function.
just write if(collision.gameObject){}works too
@@lucasnasr8496 not working
when I click the spacebar, nothing happens, I don't know if it's a project sentings problem
please help me
Thank you for this tutorial I am tired of searching how to jump the player only one time
Thank you for this amazing tutorial
Hello i wanted to know how do i make the fall when i jump faster? is tooo slow and you can literally move in the air
I think I did something wrong, so I followed the tutorial doing the same code as you but I can only jump once and after I land I can’t jump again, what’s happened?
probs you not set the varible back to true so you can jump again? Or something might not match in the script and your tags or names
@Jake Smeef03 This should help
void OnCollisionEnter(Collision collision)
{
if (collision.collider.tag == "Ground")
{
groundCheck = true;
}
else
{
groundCheck = true;
}
}
@@spyzn thx i know im not him but this helped me a lo9t
@@DemonPig666 no problem :) always happy to help.
make sure your void OnCollisionEnter is indented to the right area. Make sure it isn't within the void update function
9:42 I had been having dis problem since a week..Ty I finally fixed it
I have I have some help because when you jump you slightly slow down and move normally when you touch the grounf
i rly wish that you didnt stop filming
nice tutorial btw
ty a lot
I plan to make more tutorials soon. Thank you for your comment!
Good work Dayi
Thank you bro you just saved me so much time subscribed
for me after I jump my character slowly goes in the air , yk why?
It didnt work for me Unity 2020.3.19f1 :/
How to do it so it can jump while its moving
Hey man, thanks for the tutorial, just one question:
When setting the variable back to "true" in the OnCollisionEnter() method, for me it does not set back to true. It becomes false when the user has jumped, but when landing it doesn't change back to true. I even checked to see if it the method was working by putting a Debug.Log and the method DOES execute, but the variable doesn't change. Any fix for this?
Is there a way to make shake camera when landing
Thank you for the video, but please, zoom in, so we can see clearly
the letters is very small.
Thanks man, this made it so simple!
THIS CHANNEL IS AMAZING you helped me so much thx
You are a savior btw
can you please copy and paste the script ? plz
so it works fine but when I take the cube to a slope it glitches and I cant jump
Great Job with the tutorials! Hopefully you will continue them.
Quick question, for example, when you jump on the platform and stay on the edge the player object will "fall" (change z axis rotation) how can i stop that?
I added "rb.constraints = RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezePositionZ;" this stops that BUT if i stay on the edge on the platform long enough, then the object will walk on the side of the platform like a spider.
How would one edit it, as to make the player "stand" on the edge but not fall, BUT also freeze the axis as to stop the side of the platform from becoming "the floor", i dont know if you understand what i mean.
Thank you very much for your feedback. If I understand it correctly, you want the cube to stay on the edge without falling and not slide from the side of the platform. Right? If it is, I'll try to find a solution tomorrow.
@@DenizSimsek Basically yes, as long as 1 pixel is on the platform, the player wont fall, BUT if it falls, i want the player to stay in the upright position, right now it starts falling and it "lands on the face".
I tried with the constraints as i said, but then the side of the platform becomes the new "down" or floor.
Ok I figured it out, to anyone wondering.
Under the rigidbody component for the player, theres a little dropdown menu called constraints, tick the boxes for freeze rotation on x y z and now your player objects stays upright! :D
Glad you figured it out. Have fun!
This is a bit wrong as it would refresh your jump even if touch the side of an object named floor it wont refresh the jump if it lands on an object which is not floor. Shouldn't we use raycasts pointing downwards
Thank you for this masterpiece!!!!
why my character jump still flying when I take the code to the input event.... I already have rigidbody..
Guys pls anyone one answer, how can n make it the opposite direction in looking up and down
Thanks, bro Loved it I finally made my cube jump after 3 weeks I move my cube
bro why I fell down after some time I moved I am using capsule
@@aadi.124 on your rigidbody control freeze the x y z constraints for rotation
Thank you very much, the script is so simple. Subscribed.
I will add a new video with touch controls for jump
when? ♥
@@kitsunedotexe3587 maybe when he is dead
@@threek4018 f
i got error CS1003: Syntax error, ',' expected while making bool pls help
This was so helpful
Even though it is not jumping in the air But when it comes to ground then 'cubeisonground' doesn't checks to true..... due to which it doesn't jump any more.....
The cube needs to collide with a game object which has a tag of “Ground” when it is landed
@@DenizSimsek it is colliding when it falls down.....
OnCollisionEnter()
{
onGround = true;
}
Thank you so much you rly help me a lot
wait it jumps on the side of it, how would i fix that?
holy, simple yet affective for me 😁
bro keep up :))
Hi I would aprecciate it if you could help I wrote
public bool FeetIsGrounded = false;
private void OnCollisionEnter(Collision collision)
{
if(collision.gameObject.tag == "Ground")
{
FeetIsGrounded = true;
Debug.Log("Feet are grounded.");
}
}
but it doesn't work. why?
I have a character controller in my code too, but with a character controller the jump code doesn't work anymore, what can i do?
This Video is amazing!
Great Job
I love this tutorial so much. Thank u so much.
Thanks bro, you help me a lot
how do you fix your player jumping only once
im getting an error from "OnCollisionEnter" it is say unexpected symbol
my code is writen the same as you though any help?? thanks
I'm stuck. I can only jump once. The CubeIsOnTheGround box doesn't check again. Stays unchecked.
Edit: Nevermind, fixed it somehow, don't ask me how lol.
Damn, I have the same problem....
same problem ,how did you fix it
Thank you man. I had a big headache because of the "flappy bird" jump controls on my player.
my first jump is normal but the jumps after barely goes in the air
Bro when done this showing that forcemod not exist
Thank you so much!!!! This was very useful
i change the name of "cubeisonground" to "playerOnGround" and did everything exacttly the same but it goes bad with my movement and just docent stop jumping, any idea what i might of done wrong?
But this only works if the bottom game object is called floor, so you have to add everything by hand for different floor objects, inefficent.
Just a tip :-
Watch every yt tutorial at x1.5 speed
Nice tip 👍🏻
ikr, they reeeeally want it to be as long as they could, even if they stretch it annoyingly much
UnassignedReferenceException: The variable rb of Move has not been assigned.
You probably need to assign the rb variable of the Move script in the inspector.
UnityEngine.Rigidbody.AddForce (UnityEngine.Vector3 force, UnityEngine.ForceMode mode) (at :0)
Move.Update () (at Assets/Move.cs:29)
i need help it doesn't jump almost every time its like I can jump only once
Hey, I have a problem, the thing is that I can't jump when I jumped, I mean, I can only jump once, after that I can't jump, I know it's because of the position but I don't know how to solve it, help please
This Should Help!
void OnCollisionEnter(Collision collision)
{
if (collision.collider.tag == "Ground")
{
groundCheck = true;
}
else
{
groundCheck = true;
}
}
@@spyzn thanks!
@@wiljuniorelcrack4144 no problem man, happy to help
When i press space, the onGround bool turns off, but the player does not jump. Why?
other tuts are way too complex.. tysm
for some reason its not working for me its telling me that the private OnCollisionEnter for this item is invalid
great tutorial! I want more!!!
jump = touch controls please
Thank you soo much for this tutorial😍
Very good tutorial.
Thanks it HElp Me a Lot
thx. great vid
My player keeps falling through the ground.
Eyvallah reis çok sağolasın
Thank you for this tutorial !
Glad it was helpful!
'boooleann' the way he said it lol
Thank you very much.
THANKS THAT HELPED
Deniz sorry for basically spamming all your vids with ideas but I was wondering if you could do a tutorial on, "WaitForSeconds" and the "IEnumerator" functions.
Thank you so much!!
I don't wanna sound lazy but anyone got the source code
me need too
May I ask how can I apply the nice lighting to my own unity game?
For me it’s only able to jump once and after that it can’t jump at all
Great video 👍
Thanks 👍
You Can Use Also if (Input.GetButtonDown("Jump") && Mathf.Abs(rb.velocity.y) < 0.002f)
finally a good tutorial
Thank you!
You are awesome man, thanks for your tutorials! :D
how if I use Character Controller instead of Rigid Body? Can I use both of them?
You don’t need to use Rigid Body with Character Controller, because with that you control the character without physics. With Character Controller you just give a y position to your player when the Jump button pressed down. If you want to keep the Rigid Body and use Character Controller for jumping then you should disable gravity from the Rigid Body, I think.
@@DenizSimsek okay.. thanks..
Thank you soooooooooo muuuuuuuucchhhhhhhhhhhhhhhhhhhhhhhh!
9:40 Try typing "Untagged" so you he can jump without changing the tags
My error is saying "the reference script on this behaviour (GameObject) is missing." PLease help!