How to Jump in Unity 3D: Jumping Like Mario [Built-In Character Controller #3]

  Рет қаралды 92,430

iHeartGameDev

iHeartGameDev

Күн бұрын

A breakdown and explanation of how to jump in Unity3D! Learn to jump like Mario! Implement jumping using c#, the built-in character controller and Unity's New Input System!
This beginner-friendly tutorial is a COMPLETE walkthrough of how to use Unity 3D's built-in character controller to get a character jumping while incorporating animations! In addition, we take the time to break down complicated concepts and understand how it all works!
ACCESS PROJECT FILES & SUPPORT THE CHANNEL:
💛 / iheartgamedev
iHeartGameDev Merch:
💛 www.iheartgamedev.com
WANT MORE?
Interested in learning more about animating characters in Unity? Check out my growing series of tutorials:
✅ • Unity's Animation System
✦ Like the vid? Please consider Subscribing!
bit.ly/2YdIb6j
✦ Missed out on the last episode?
• How to Move Characters...
SOCIAL:
✦ Discord
/ discord
✦ Twitter
/ iheartgamedev
LINKS FROM THE VIDEO:
🤖 Download Jammo for YOUR game:
assetstore.unity.com/packages...
⭐ And Check Out @mixandjam !
/ mixandjam
🌐 Learn about Jumping
• Math for Game Programm...
lolengine.net/blog/2011/12/14/...
⭐ Kyle Pittman
/ piratehearts
GEAR:
Lumix G7 Camera: amzn.to/3Kks1gZ
Epomaker GK68 Keyboard: amzn.to/3Ke87EB
Samson C01U Pro Mic: amzn.to/33kDdtG
LG 27" Monitor: amzn.to/3qAHFwS
Lepow 15.6" Portable Monitor: amzn.to/3287OtL
Logitech G604 Mouse: amzn.to/3A6jNV4
Audio-Technica ATH-M50X Headphones: amzn.to/3tBaeMT
X-Pen Artist 15.6 Pro Drawing Tablet: amzn.to/3FE5HLI
Apple 15in MacBook Pro Laptop: amzn.to/3AbKdFc
►TIMESTAMPS:
Intro: 0:00
Mario Jump Analysis: 0:40
Episode 2 Recap: 1:40
Tutorial Start: 2:42
Add Jump Action: 3:02
Add Jump Callback: 3:53
What is a Callback: 4:20
Callback Phases Explained: 4:45
Concepts of Jumping: 6:56
Graphing Out A Jump: 7:50
Variables We Need To Jump: 8:30
Current Gravity Implementation: 9:13
Setup Jump Variables: 10:05
Building A Better Jump Shoutout: 11:37
Writing a HandleJump function: 11:57
Velocity Verlet And Euler Integration: 13:42
Fall Gravity Explained: 16:28
Adding Animation: 18:58
The Mixamo Animations: 19:45
Imported Animation Setup: 20:17
First Jump Animation State: 21:32
Accessing Animator In Code: 22:31
Mario Jump vs Jammo Jump: 23:33
Multiple Trajectories Section: 24:01
Dictionaries Explained: 24:42
Multiple Trajectories Implementation: 25:03
Coroutines Explained: 27:00
Multiple Trajectories Animations: 29:00
JumpCount Coding: 32:00
Final Product: 32:33
Next Time: 32:54

Пікірлер: 255
@TheJazzygeoff
@TheJazzygeoff 2 жыл бұрын
A masterpiece, Nicky. The production quality, the graphical visualisations, the pace of the coding sections, correctly refrencing the contributions of others, and the engaging voice work.
@iHeartGameDev
@iHeartGameDev 2 жыл бұрын
Thank you for such a kind comment, Geoffrey! The kindness means a lot! I hope the video helps you too!
@user-ef6tm3ut4r
@user-ef6tm3ut4r 2 жыл бұрын
@@iHeartGameDev we need more like these bro
@kingdom216
@kingdom216 2 жыл бұрын
Perhaps you can help me Geoffrey, I have written the code exactly as it is shown, but I get compiler errors. The main one is this: Assets\Standard Assets\Characters\ThirdPersonCharacter\Prefabs\My Scripts\AnimationMotionController.cs(48,39): error CS1061: 'PlayerInput.CharacterControlsActions' does not contain a definition for 'Jump' and no accessible extension method 'Jump' accepting a first argument of type 'PlayerInput.CharacterControlsActions' could be found (are you missing a using directive or an assembly reference?) I am continuing from the other two parts in this tutorial series so everything is set up as it is supposed to be, since this video has helped you, can you please help me to find where my mistake is?
@peonso
@peonso 2 жыл бұрын
@@kingdom216 Start this video from scratch again, you missed some step or have a typo somewhere for sure.
@TheJazzygeoff
@TheJazzygeoff 2 жыл бұрын
@@kingdom216 , as a guess, that error message suggests to me that you have not created an action called "Jump" in your input actions which you seem to have called CharacterControlsActions - you know, the place where you setup the input bindings, etc. Have you spelled it correctly?
@darth6129
@darth6129 9 күн бұрын
This is like the only 3d Platformer Tutorial that made a professional looking result that I could find. Excellent job!
@blazhevski
@blazhevski 2 жыл бұрын
i started making a 3d platformer prototype a while ago, while i managed to make simple movement and a simple double jump mechanic i couldn't get it quite the way i wanted it to be. excited for this video!
@AlexBlackfrost
@AlexBlackfrost 2 жыл бұрын
Loved it! You did a pretty good job explaining complex topics like Verlet vs Euler in such a way that it is easy to understand.
@clintonmansfield6364
@clintonmansfield6364 2 ай бұрын
You really do have a gift of explaining things. The composition and detail of your videos really show how much thought and work you put into them. You probably deserve more than you get from it all, but I can guarantee you that people appreciate it and that your insight is inspiring. Thank you sir
@themodernpirate2827
@themodernpirate2827 2 жыл бұрын
I've been waiting so long for this video to come out that I start to think he must have thought: "nah, this series are too good to be free for the general public, from now on, it will be exclusive only to patreon supporters" Thank you for your work, time, effort and dedication to this videos, seriously.
@OfficialSiem
@OfficialSiem 2 жыл бұрын
I love this video, and I really think most of your vids deserve more views! Amazing anaylsis/breakdown!
@stuartmurton7319
@stuartmurton7319 2 жыл бұрын
I have watched a lot of tutorial stuff over the years (including Udemy) and this channel is by far the best content I have come across. Going to check out the patreon!
@sandboxgames1461
@sandboxgames1461 Жыл бұрын
You. Are. A GOD!!! Just subscribed and I'm now going to binge watch all your content. Best game development tutor hands down.
@anshpudaruth5549
@anshpudaruth5549 Жыл бұрын
The best tutorial I've seen yet since Brackeys. Tysm
@fulongfromthegrave
@fulongfromthegrave 2 жыл бұрын
Love the series awesome job! Looking forward to the the next series!
@BFFUWGTHAFO
@BFFUWGTHAFO 2 жыл бұрын
You have been sent by the codings gods! Thank you so so much I hope I can get to see more of your tutorials and hope to learn as much as possible!!!!
@DHrUVSpY
@DHrUVSpY 2 жыл бұрын
Thank you so much, Nicky. Your content is saved my time. you're amazing at explaining full of meaning each code. Request for explain follow camera to character
@mehoreo3156
@mehoreo3156 11 ай бұрын
Incredible tutorial! Very easy to follow and with great instructions!
@CosmicComputer
@CosmicComputer 2 жыл бұрын
I can't wait for the dynamic rigidbody character controller series!
@castlecodersltd
@castlecodersltd Жыл бұрын
This is a great tutorial which has been really helpful to me. Thank you ☺
@paulorodriguez6288
@paulorodriguez6288 2 жыл бұрын
Aaah yes thank you for this video! This is the first time I've seen the state machine animation block and I'm blown away, I wish I discovered it sooner. This approach to jump is really useful and you can easily modify it to work with rigid bodies. Very cool
@iHeartGameDev
@iHeartGameDev 2 жыл бұрын
Awesome Paulo! Happy to hear that it has already helped you 😊
@zebulon.a
@zebulon.a 9 ай бұрын
my apologies for the year old comment. How do you convert this for rigid body instead of character controller?
@tigranavagyan1587
@tigranavagyan1587 Жыл бұрын
Huge thanks to you, Nicky!!! This is a GREAT TUTORIAL
@MarcV_IndieGameDev
@MarcV_IndieGameDev Жыл бұрын
Man, your teaching style is the best I've watched on the internet so far.
@iHeartGameDev
@iHeartGameDev Жыл бұрын
Thank you Marc :) happy to hear that you like it
@sngaulin
@sngaulin 2 жыл бұрын
Wow, I started the serie just to get a refresh on character controllers but damn yours is getting good and so simple to understand so we can mod it that I'm just going on Patreon to get access to the file! Awesome job! Keep going!
@iHeartGameDev
@iHeartGameDev 2 жыл бұрын
Awesome to hear, thank you! Please let me know if there’s any issues downloading the files 👍
@Dominik-K
@Dominik-K 2 жыл бұрын
Thanks a bunch as this is really a great tutorial and I have to say it explains the concepts and implementation very succinct and precisely.
@iHeartGameDev
@iHeartGameDev 2 жыл бұрын
Thanks very much Dominik! I tried my best!
@markodhiambo6457
@markodhiambo6457 Жыл бұрын
Thanks this was lifeline it made the jump look realistic and normal.
@epiksol_
@epiksol_ 2 жыл бұрын
Great job, Nicky! Keep it up!
@StillCisTho42
@StillCisTho42 2 жыл бұрын
I can believe this content is free. Thank you;
@alienouz
@alienouz Жыл бұрын
love this channel contents, very very helpful tutorials. Many Thanks
@heyitsjoshmusic
@heyitsjoshmusic 2 жыл бұрын
I've been looking everywhere for a proper analysis and implementation of Mario's jump. Not a Unity developer, but the production quality, explanations, and results are so good that I am considering attempting to apply the logic to Unreal.
@iHeartGameDev
@iHeartGameDev 2 жыл бұрын
Hey thanks so much for the kindness!!
@tamilmaran4000
@tamilmaran4000 2 жыл бұрын
I would like this video a thousand times if I could. thanks a lot man.
@VojtaKoci
@VojtaKoci 2 жыл бұрын
Oh damn, your tutorials are just the best... As an animator myself, I'm really glad that you keep the channel a bit "animation-heavy", but your coding is just so well executed. Even though I usually already know most of the things you're talking about in your vids, I always watch every single one of them, because they are probably the best Unity-centric content available. You're doing a great job man, thank you very much! Also I was wondering if you considered telling us something about inverse kinematics? I mean, most of it is quite well covered (at least quantitatively - there's quite a lot videos on that topic), but the tutorials are most often quite incomplete and not well done. There's surprisingly very little video material on well executed 2D runtime rigging, but I guess 2D is not your cup of tea. But any in depth tutorial on runtime rigging would be great! Cheers from Czech Republic, thank you for your vids, keep up the great work and have a great day!
@iHeartGameDev
@iHeartGameDev 2 жыл бұрын
Wow what a fantastic comment! Thank you so much for watching and for the kindness 😊 Regarding IK: I actually haven’t really ever used it myself. I think I’ll be getting to it eventually as we cover more topics on the channel!
@rydergetson4789
@rydergetson4789 Жыл бұрын
This was very helpful!
@signalised9540
@signalised9540 2 жыл бұрын
Another great video Nicky! Excited to see more!
@iHeartGameDev
@iHeartGameDev 2 жыл бұрын
Thank you Sig!! Hope all is well, buddy!
@signalised9540
@signalised9540 2 жыл бұрын
@@iHeartGameDev Aswell as one can be in these times! Hope you're doing better!
@SanyaBane
@SanyaBane Жыл бұрын
While info in your videos is simply "really good", your editing level is over 9000. Thank you.
@jadonmullinex9389
@jadonmullinex9389 2 жыл бұрын
I used the clearly-presented info in this video to clean up messes I made following other tutorials :D
@rogerwarford1517
@rogerwarford1517 Жыл бұрын
Love these videos! For what it's worth, there is a small error in handleJump() (26:09 in the video). Lines 75 through 78 should be: float secondJumpGravity = (-2 * (maxJumpHeight * 1.5f)) / Mathf.Pow(timeToApex * 1.25f, 2); float secondJumpInitialJumpVelocity = (2 * maxJumpHeight * 1.5f) / (timeToApex * 1.25f); float thirdJumpGravity = (-2 * (maxJumpHeight * 2f)) / Mathf.Pow(timeToApex * 1.5f, 2); float thirdJumpInitialJumpVelocity = (2 * maxJumpHeight * 2f) / (timeToApex * 1.5f); Note that we are multiplying by 1.5 and 2.0 rather than adding 2 and 4. This only matters if maxJumpHeight is set to a value other than 4.
@clintonmansfield6364
@clintonmansfield6364 2 ай бұрын
I know this comment is a year old now, but would you call this an error or a preference? I personally prefer the addition and not the multiplication for any value of maxJumpHeight
@rogerwarford1517
@rogerwarford1517 2 ай бұрын
@@clintonmansfield6364 I personally consider this a bug because if you do addition the second and third jump are not proportional to the first jump. So for example if maxJumpHeight is 2, then the second jump will be double the regular jump, rather than 1.5 times. Likewise if maxJumpHeight is 8, then the second jump would only be 25% of the initial height. I think this would be confusing if you tried to reuse this code and needed a different maxJumpHeight.
@anthonycapron1173
@anthonycapron1173 2 жыл бұрын
Excellent ! thank you very much !!
@theunluc1508
@theunluc1508 2 жыл бұрын
Thank you Mr.Nicky!!
@tarekmustafa2525
@tarekmustafa2525 10 ай бұрын
This channel is gold! Thank you!!
@iHeartGameDev
@iHeartGameDev 10 ай бұрын
thanks so much!
@jamesreed319
@jamesreed319 2 жыл бұрын
Loving these tutorials, any chance we can get one on adding a camera to the player using cinemachine?
@momozaki4453
@momozaki4453 2 жыл бұрын
WAITING!!
@holdenthompson1449
@holdenthompson1449 2 жыл бұрын
Amazing.
@EnjoyPoPcornYagnik
@EnjoyPoPcornYagnik 2 жыл бұрын
Thanks!
@mathieuyato9366
@mathieuyato9366 2 жыл бұрын
Hi, I was wondering will you do a momentum based movements tutorial ? Like the Mario one we can see in odyssey, etc. Would be interesting to see it. Like how would you manage acceleration, deceleration in the air and on the ground 👍
@drepp1398
@drepp1398 Жыл бұрын
I nver see this quality in a channel i love this
@iHeartGameDev
@iHeartGameDev Жыл бұрын
Thanks very much!
@mowalduchiwa1560
@mowalduchiwa1560 2 жыл бұрын
thank you
@guille_sanchez
@guille_sanchez Жыл бұрын
Hi @iHeartGameDev! First of all, thanks for the amazing tutorials. I want to give some feedback on the jump button release: Wouldn't it be nice if we set a min jump height for the "jump button release"? If there's no min jump height, then when you spam the jump button rapidly there gives inconsistent jump arcs and that feels really bad. If you take Hollow Knight as an example, when you tap the jump button rapidly the character hops quickly but with the exact same jump height (which is the minimum jump arc/parabola/or time, depending on which implementation is used), so the arcs of the jump for the min jump are always constant. The last time I coded the min jump I did it by comparing 2 things in fixedUpdate: (1) Jump Button UP and (2) the current Y velocity is less than a threshold that you set (this threshold could be your "initialJumpVelocity" - "a small amount (for instance, minJumpVelocity = initialJumpVelocity * 0.9f)". If the initialJumpVelocity is 10, then the minJumpVelocity = 9). This ensures that at least the character is going to travel a minimum distance (the distance travelled from the initialJumpVel until it reaches the minJumpVelocity by deceleration) before falling back down. A drawback of this implementation is that is less intuitive to set up, because you have to test the values until you find the min distance travel that you like for your jump. My question is, given your current implementation, is there a better way to set this minimum Jump height that suits the rest of the Jump with the verlet integration? The one I suggested would do it (In fact, I tested with 60fps and with 800fps and the results are very consistent across framerates), but its consistency is similar to the euler approach, there are still a really tiny amount of error, not really noticeable for a normal jump. However, if you set the jumpHeight to a really large number, then the inconsistencies could be a bit more noticeable (still low though, but worth to be corrected).
@FAISAL-ky7ps
@FAISAL-ky7ps 2 жыл бұрын
I always love your tutorial XD
@iHeartGameDev
@iHeartGameDev 2 жыл бұрын
Thank you!!! I hope it helps!!
@mihaistanciu2487
@mihaistanciu2487 2 жыл бұрын
The biggest problem in jumping is to be able to sync the animation with the actual jump. You chosed some settings on animations without any explaination of why you did that or what that mean(like set the root transform position etc). Judging on your previous videos I was expecting more. Anyway, keep up the good work.
@iHeartGameDev
@iHeartGameDev 2 жыл бұрын
Hey - thanks for watching! I tried my best here to replicate Mario’s instantaneous transition and stated why we were modifying the transition duration to allow the animations to blend better. There should be bits of explanation for most everything incorporated in the video, including why we were modifying animation transitions.
@andresinish
@andresinish 2 жыл бұрын
For me the static poses weren't working for me, because the timing was a little off, but i replace them with some actual animations and it was a whole lot smoother and the timing was way better, i guess you could try that instead. :)
@hasnain_elahi
@hasnain_elahi 2 жыл бұрын
Mind blowing explanation. Greatest ❤💙❤ .Make a video on Pun 2 multiplayer ❤💙❤
@odinniereece4096
@odinniereece4096 2 жыл бұрын
🙂🙂Wonderfully explained Nicky great work... Keep it up..
@iHeartGameDev
@iHeartGameDev 2 жыл бұрын
Thank you for the kindness Odinnie! Great to see familiar faces around here :)
@odinniereece4096
@odinniereece4096 2 жыл бұрын
@@iHeartGameDev ☺️☺️☺️ I see... You remembered me...
@odinniereece4096
@odinniereece4096 2 жыл бұрын
@@iHeartGameDev I honestly never thought youtubers would remember the persons who comment on their videos...
@iHeartGameDev
@iHeartGameDev 2 жыл бұрын
I can’t speak for everyone, but I try to!
@odinniereece4096
@odinniereece4096 2 жыл бұрын
@@iHeartGameDev thats great.. I actually like that about you
@ambiguouscompany
@ambiguouscompany Жыл бұрын
Amazing. Is it easier to just have a blend tree for idle, walk, and run to simplify the transitions/have only one movement logic for the character controller, or does this not work properly?
@deagarys
@deagarys Жыл бұрын
Awesome tutorial! i've come upon an issue that when I do my second or third jump without moving the animation becomes weird. While I move it works perfectly though. Do you know how to fix this?
@mysxt
@mysxt 2 жыл бұрын
Will u be making any animation tutorials? Like in blender how to animate instead of taking them from Mixomo for example animations like Jump, Run, Idle, Slide, Crouch and all that. Would be greatly appreciated
@devinmcgee5265
@devinmcgee5265 2 жыл бұрын
10/10
@ninjedi6710
@ninjedi6710 Жыл бұрын
Deserves more subs
@iHeartGameDev
@iHeartGameDev Жыл бұрын
Thank you
@paulricordeau1370
@paulricordeau1370 2 жыл бұрын
Wow just perfect, it works sooooooo well! Anyone know how to add air control while jumping? Is there a way to isolate the y velocity of the player rather than use current movement.y?
@Hiturion
@Hiturion Жыл бұрын
regarding the physics, there is a bit of a confusion between Acceleration and Velocity. But we get your point ;).
@ichliebelongboarden
@ichliebelongboarden Ай бұрын
Very helpful, thanks. There is a correction though. When you land back on the ground, the y velocity is 0 and so is the acceleration. This is because you are no longer moving vertically. If your y velocity was nonzero, then you'd be moving vertically. If your y acceleration is nonzero, then your vertical velocity would be changing. Neither of these are true, so both y vel and acceleration are zero. Also, your Verlet integration isn't correct. You are effectively just doing Euler integration with half the acceleration you want and declared with the gravity variable. Simply put, Verlet integration yields v(t+dt)=v(t)+.5(a(t)+a(t+dt))dt, which in the case of constant acceleration like we have here, that is the same as Euler integration (because a(t)=a(t+dt)). You only want Verlet integration if you have non-constant acceleration. So just use Euler integration with gravity cut in half, if you like the effects of what your code did.
@vima9046
@vima9046 Жыл бұрын
Hello Nicky! Couls you please explain me why you modify the initialJumpVelocity at 16:14? Wouldn't it just work like it is?
@Somiaz
@Somiaz 2 жыл бұрын
I'm curious and also stuck, how can I make the character turn in the direction the camera is pointing while also keeping all the rotation code from before?
@kiddynamo66
@kiddynamo66 2 жыл бұрын
Awesome tutorial! Can we do camera controls next?
@jroc6745
@jroc6745 2 жыл бұрын
Great tutorial thanks for posting. I have a question, currently the character stays in the jump animation the entire jump. How do you impliment a falling animation once the character reaches the apex of the jump?.
@iHeartGameDev
@iHeartGameDev 2 жыл бұрын
Thanks! There is logic already in the script that incorporates checking if the character is falling. Seems like a solid spot to switch the animation too!
@Dudoi
@Dudoi 2 жыл бұрын
Hi, just amazing these character controller tutorials. I'm learning about game developing and programming and I loved your way of explaining. As I remember Mario doing the 3 jumps without pauses when touching the ground, I tried to apply the same concept in case the jump button is pressed as soon as you hit the ground execute the second jump by changing the if of "handleJump" to " if (characterController.isGrounded && isJumpPressed)" is there any problem I didn't notice when removing !isJumping? Thank you very much for the tutorial
@iHeartGameDev
@iHeartGameDev 2 жыл бұрын
Hey! You are free to experiment and try out any changes and refractors you want! No big deal!
@DonDisainer
@DonDisainer Жыл бұрын
if im using rigidbody is the same but rb.velocity = currentMovement ? thnx for this tutorial!!!
@GhosttheassassinSJ
@GhosttheassassinSJ 2 жыл бұрын
Hey is there a way to change the handleRotation method to rotate with the mouse instead of the WASD keys?
@gowtham27501
@gowtham27501 2 жыл бұрын
Great work ,do you kown why no video in mix and jam for long time
@iHeartGameDev
@iHeartGameDev 2 жыл бұрын
Thank you! I'm not sure about Mix And Jam. But André's videos are some of my favorites as well!
@danielbezerra5650
@danielbezerra5650 2 жыл бұрын
Nicky, please, i need your help! how can i do a ledge grab? i tried everything but nothing worked. You have a big fan from Brazil!
@ColdOneK
@ColdOneK 2 жыл бұрын
This video is really informative. I'll definitely be able to use some of this stuff for a kinematic Rigidbody character controller. Just need to convert from the CharacterController, I've wasted so much time on. Try doing jump-through platforms, without turning off the platform's collider. Spoilers. You'd think using the collider.isTrigger = true; function of CharacterControllers would do it. It doesn't. CharacterController controller; controller.detectCollisions = false; Doesn't actually do anything. I'm in 2019.4.29f1, so ymmv in the 2020 version, but it simply doesn't actually do anything in my version.
@symmetrythomas7376
@symmetrythomas7376 11 ай бұрын
How would you apply this to knock back force using the character controller and Collision detection?? PLease help
@hermanator5543
@hermanator5543 2 жыл бұрын
​Hello, could you please include the smoke particles trail that Mario has in this tutorial? It would be awesome and I would really appreciate it XD
@iHeartGameDev
@iHeartGameDev 2 жыл бұрын
Hey Hermanator! Unfortunately that’s one of the few things I don’t cover. The video is my longest yet and adding in the particle effect would have added even more! Maybe that would be a great short video to make after though! I’ll include it in the next Patreon poll 🙌
@hermanator5543
@hermanator5543 2 жыл бұрын
@@iHeartGameDev okay, thanks!
@sergey2305
@sergey2305 2 жыл бұрын
Maybe the next video will be about how to make a combat system?
@tomdriver6733
@tomdriver6733 11 ай бұрын
How to prevent steering during jump and continue after touching ground? Switch off steering and buffer input somehow.
@mathieuyato9366
@mathieuyato9366 2 жыл бұрын
Hi, wonderful tutorial, I just have one problem it seems like my player jump at the jump height that I have specified when I use the velocity Verlet, do you know why ?
@iHeartGameDev
@iHeartGameDev 2 жыл бұрын
The implementation by the end of this video is not 100% correct. There is a follow up video that might fix your problem
@mathieuyato9366
@mathieuyato9366 2 жыл бұрын
@@iHeartGameDev Hi thanks for the answer, it seems like even after the fix my character still doesn't reach the height desired.
@stevenmorgan3869
@stevenmorgan3869 2 жыл бұрын
Hello I love your videos but for some reason if I hold dow the jump button my character keeps jumping. Is there anyway to stop it
@bryanl7738
@bryanl7738 7 ай бұрын
Came for the video game mechanic tutorial, stayed for the applied calculus lesson
@corrput
@corrput Жыл бұрын
is there a reason we don't just do the physics calculations (gravity) in fixedupdate?
@sanamoawed9522
@sanamoawed9522 Жыл бұрын
Can u make GROUND POUND attack with character controller
@ramaarya2157
@ramaarya2157 2 жыл бұрын
I've followed the tutorial until 12:42 minutes, but when I enter play mode, my character doesn't jump. Even though I've followed all the code. any suggestions for me? thank you, your tutorial is very good (sorry if my english is bad)
@KKirmaci
@KKirmaci 2 жыл бұрын
Same here, I reckon that the issue lies in the fact that we never use the jump variables anywhere else. Being a total beginner in c#, I can't figure out where to put it too ^^'
@alessio_763
@alessio_763 2 жыл бұрын
had the same problem, just follow until 16:28
@RKO175
@RKO175 Жыл бұрын
any other solution i followed the video but nothing happens Edit: i fk up in the variables and my velocity was negative thats was my problem xD
@kaiserkarry8242
@kaiserkarry8242 Жыл бұрын
Between the videos, he adds "* Time.deltaTime" into the handle gravity function. Mine wasnt working either till I added those, guess he accidently forgot to put it in the video to add it from the previous one
@Captain_re5
@Captain_re5 8 ай бұрын
the gravity snaps the player into the ground and it cannot jump is there any fix for the gravity, i followed the tutorial before about the gravity and it was snapping player to the ground too. how am i gonna get it to jump if its snapping!
@koreanjesus2712
@koreanjesus2712 Ай бұрын
try disabling "apply root motion" in the animator
@andrewknutson8584
@andrewknutson8584 Жыл бұрын
Hey, first off Great tutorials man! I'm having a beginner's error and something in the gravity and grounded bits isn't working. I'm trying to learn coding for games so I can create it from scratch and am trying to not just copy and paste, but I also have an ambitious schedule I got to follow. As Far as I can tell, I've followed the tutorial just fine. My model just seems to not fall off things or goes flying exponentially when jump is pressed. I'm brand new to this, any ideas?
@andrewknutson8584
@andrewknutson8584 Жыл бұрын
Got the fall fixed, but the jump still is crazy.
@andrewknutson8584
@andrewknutson8584 Жыл бұрын
Next Video fixed my problem.
@peegoggles
@peegoggles Жыл бұрын
@@andrewknutson8584 Thank you I had the same problem
@mikeken7105
@mikeken7105 2 жыл бұрын
Hello, this is a great course. But I have a question. We use velocity verlet, but we don't use v0*t + 1/2*a*t*t in the move method to calculate the displacement, why is that so? Don't we need to use v0*t + 1/2*a*t*t to calculate it? I hope I can get your answer, thank you very much.
@iHeartGameDev
@iHeartGameDev 2 жыл бұрын
Hey Mike! If you follow this tutorial, be sure to check out the follow up to it. I did make a mistake and I fix it in the follow up :)
@mikeken7105
@mikeken7105 2 жыл бұрын
@@iHeartGameDev Okay I understand, I will continue to follow the tutorials, and I really like your tutorials, thank you very much : )
@HyagoPinheiro
@HyagoPinheiro 2 жыл бұрын
Great tutorial. Thanks :) You could replace Mathf.Pow(timeToApex, 2) by timeToApex * timeToApex (line 67 at 11:30) Pow is an expensive function.
@iHeartGameDev
@iHeartGameDev 2 жыл бұрын
Glad you liked it! And that is great to know! Thank you for sharing the knowledge!
@shroomik8510
@shroomik8510 2 жыл бұрын
Hi. When I press run and jump the jump is smaller then when I just walk and jump. How fix it?
@xcraft86
@xcraft86 Жыл бұрын
How do we prevent our character from falling through the ground in the jump Router? My character falls through the ground when it is in the jump Router because there are no animation. Should we have something to prevent falling?
@shammahcharles4941
@shammahcharles4941 5 ай бұрын
Can you please make one for melee combat! please!
@SBAFMovies
@SBAFMovies 9 ай бұрын
Me who dosent know how to code and dosent understand any unity tutorials: cool 👍
@tomdriver6733
@tomdriver6733 11 ай бұрын
Isn't an Array faster than a Dictioinary?
@samad7228
@samad7228 8 ай бұрын
I need help After writing the code when I enter play mode the character just go up without pressing any button
@fakelaminated5353
@fakelaminated5353 8 ай бұрын
I made the same thing happen by changing the clamp in the else if part of the handlegravity() to a positive number. Setting it back to -20.0f fixed it though.
@deraminator945
@deraminator945 2 жыл бұрын
17:06 there where the arrow points. When you don't press any movement buttons midair, the players movement also stops and falls straight down, instead of still moving a bit forward. do you have an solution? I know it must be because of unitys character controller, but is there a solution for that?
@iHeartGameDev
@iHeartGameDev 2 жыл бұрын
That’s because the current movement implementation isn’t acceleration based, I believe. You would need to handle movement on the x and z axis differently than we currently do. More like three two dimensional blend tree tutorial I released on this channel. Rather than how we implement it here, which is purely based on player input.
@deraminator945
@deraminator945 2 жыл бұрын
@@iHeartGameDev Thanks for the quick response :)
@sufianahmad7337
@sufianahmad7337 2 жыл бұрын
I watched the animation series and I am working to make cool jumps. I would like to know more than unity.physics. the code I am using is: Rb.velocity=velocity.y+float. It works fine but the problem is that I want my object to look heavy. But useGravity is a bool and API is not accessible. Plus due to zero air resistance mass doesn't make any change.
@iHeartGameDev
@iHeartGameDev 2 жыл бұрын
Hey Sufian! Thanks for watching the series on animation! Currently I’m not handling rigidbody physics. I think we’ll get there eventually though so stay tuned!
@Bidule200
@Bidule200 2 жыл бұрын
Gravity value is accessible in Project Settings > Physics (default is 9.81 like on Earth). It's a global setting, so you can't tune it for every object. For air friction (what makes objects look light or heavy) the rigidbody parameter to tune is Drag (and Angular Drag). Anyway, you shouldn't use default Gravity for a playable character, you should compute your own and apply it as a vertical acceleration when your character is not touching the ground.
@sufianahmad7337
@sufianahmad7337 2 жыл бұрын
@@Bidule200 I am going with your answer thanks :)
@sufianahmad7337
@sufianahmad7337 2 жыл бұрын
@@iHeartGameDev After GDC, it looks like the case study of their theory. And man you just nailed it. Thanks to be here!
@baddie.gamies
@baddie.gamies Жыл бұрын
I am pretty sure someone has asked this but why didn't you use the "Any State" for the jump animation?
@iHeartGameDev
@iHeartGameDev Жыл бұрын
:) I didn't know how that works tbh
@kingdom216
@kingdom216 2 жыл бұрын
I'm sorry did I miss something, where is the animator? what are the transitions set to? Is it: isJumping true and isJumping false bools? The other tutorial doesn't have a section for jump in the animator. Why is this never working for me? The line of code int zero = 0; wasn't in the last tutorial as a result I am getting one of two error codes one that says: Assets\Standard Assets\Characters\ThirdPersonCharacter\Prefabs\My Scripts\AnimationMotionController.cs(22,9): warning CS0414: The field 'AnimationMotionController.zero' is assigned but its value is never used, and the second error code: Assets\Standard Assets\Characters\ThirdPersonCharacter\Prefabs\My Scripts\AnimationMotionController.cs(48,39): error CS1061: 'PlayerInput.CharacterControlsActions' does not contain a definition for 'Jump' and no accessible extension method 'Jump' accepting a first argument of type 'PlayerInput.CharacterControlsActions' could be found (are you missing a using directive or an assembly reference?) what am I missing please, error happens at 12:40 video mark, I have checked and rechecked and have the exact thing typed as what is in this tutorial.
@whoisj
@whoisj 9 ай бұрын
I know I'm a year late to this, by why use a pair of Dictionary. They're expensive to look up. Why not have used a single (float Velocity, float Gravity)[]? Where index 0 is the first jump, index 1 is the second, and so on?
@mohsenmousavi2313
@mohsenmousavi2313 2 жыл бұрын
❤❤❤👍
@michaelpestanaluis-gamedes3518
@michaelpestanaluis-gamedes3518 2 жыл бұрын
I've encountered a problem after finishing all the areas until 19:00, when pressing jump my player gets yeeted, so to make small jumps i need to lightly and quickly tap the jump button, any idea how I can fix this? I've gone through the code 3 times and it's all the same.
@JahidulIslam-ev1zo
@JahidulIslam-ev1zo 2 жыл бұрын
I am having the same issue, have you found a solution?
@JahidulIslam-ev1zo
@JahidulIslam-ev1zo 2 жыл бұрын
Nevermind, my solution was that float previousYvelocity = currentMovement.y; float newYvelocity = currentMovement.y + (gravity * Time.deltaTime); float nextYVelocity = (previousYvelocity + newYvelocity) * 0.5f; currentMovement.y = nextYVelocity; it was currentMovement.y += nextYVelocity; before and now i removed the plus and its fine.
@michaelpestanaluis-gamedes3518
@michaelpestanaluis-gamedes3518 2 жыл бұрын
@@JahidulIslam-ev1zo Just saw your reply, and it worked for me, although I had to change the 'currentRunMovement.y += nextYVelocity to currentRunMovement.y = nextYVelocity as well, as the same problem would occur when running and jumping at the same time
@samarabosarah5191
@samarabosarah5191 Ай бұрын
Can You Make A double Jump move
@jennypenny8965
@jennypenny8965 2 жыл бұрын
This video is great! Newer coder here and I am having a problem. I coded exactly like you but my character does not move forward when jumping like yours does. He can jump from the idle position but when walking or running, he kinda stops and jumps in place and then continues on. I've been over the code a bunch and I don't think I missed anything. Any ideas?
@ryanzenn6896
@ryanzenn6896 2 жыл бұрын
I'm having the same problem. Have u fixed it?
@jennypenny8965
@jennypenny8965 2 жыл бұрын
@@ryanzenn6896 no, I was never able to fix it. I ended up reverting back to my old jump code and not using the input manager due to a deadline I needed to meet :(
@ryanzenn6896
@ryanzenn6896 2 жыл бұрын
@@jennypenny8965 I just fixed mine. I unselected the "root motion" of the character and it worked.
@jennypenny8965
@jennypenny8965 2 жыл бұрын
@@ryanzenn6896 oh nice! That's good to know because I may actually go back to having different jumps.
@celsoae
@celsoae Жыл бұрын
Hi o/ Dunno if is something related to the scale of the objects of my scene. But when i press jump my character skyrocket and i got an error that says: "due to floating point precision limitations, it is recommended to bring the world coordinates of the GameObject within a smaller range". Can you help?
@zgouman
@zgouman Жыл бұрын
Same problem here. Do you solved it?
@celsoae
@celsoae Жыл бұрын
@@zgouman coundnt solve it yet.... i go back to the first gravity system. and im using it.
@zgouman
@zgouman Жыл бұрын
@@celsoae I solved it. Idk exactly why but i deleted SetupJumpVariables and HandleGravity in the script and write it again. I think i had a wrong symbol for the math but i dont know which.
@celsoae
@celsoae Жыл бұрын
@@zgouman Nice! Illinois try this today
@celsoae
@celsoae Жыл бұрын
@@zgouman Same here xD rewrite and is working hahahaha crap xD
@tigeralt302
@tigeralt302 2 жыл бұрын
This is so great! I do have some questions: Why do we need to calculate the gravity again if we already set it to a number? Is it to make the controls feel better? (Is that explained in the talk you referred to?) And why is the Jump/Falling still frame dependent if we are multiplying it by Time.deltaTime?
@Tinfoiltomcat
@Tinfoiltomcat Жыл бұрын
I had this question but then I realized the answer. He isn't moving the character to jump, he's manipulating the gravity.
@angelkaki5707
@angelkaki5707 6 ай бұрын
Does anyone have an idea of how to make the 3rd jump stationary n not actually make you move??
@koreanjesus2712
@koreanjesus2712 Ай бұрын
try disabling "apply root motion" in the animator
@slavic_sloth
@slavic_sloth 2 жыл бұрын
Maybe someone can help me out here please? I'm getting this weird error when trying to jump. MissingMethodException: PlayerControls.OnJump Due to: Attempted to access a missing member. It only happens when jumping occurs. I've set up the Input Actions the same way, used the scripts the same way (without having animations). Does anyone have any idea what the issue might be? The weirdest part is that it does not effect what's going on in the game as far as I can tell. It's just an error that shows every single time I press the jump button.
@slavic_sloth
@slavic_sloth 2 жыл бұрын
I figured out the issue. It seems like a bug on Unity's behalf. I changed the default map to and when hitting play it automatically changes over to my input map. But if I use my input map and hit play there will be an error.
@SevenSinsGER
@SevenSinsGER Жыл бұрын
My Character is losing all it's foward momentum when jumping which feels really terrible. Anyone knows what's causing this behaviour and how to fix it?
Мама и дневник Зомби (часть 1)🧟 #shorts
00:47
[실시간] 전철에서 찍힌 기생생물 감염 장면 | 기생수: 더 그레이
00:15
Netflix Korea 넷플릭스 코리아
Рет қаралды 38 МЛН
Balloon Pop Racing Is INTENSE!!!
01:00
A4
Рет қаралды 8 МЛН
How to Move Characters In Unity 3D | Character Controllers Explained
9:46
Recreating Super Mario's Jump
9:32
Pontypants
Рет қаралды 67 М.
Giving Personality to Procedural Animations using Math
15:30
t3ssel8r
Рет қаралды 2,3 МЛН
I Made Super Mario 64 In 64 Hours! - Unity Devlog
10:20
Jett Lee
Рет қаралды 174 М.
Improve your Platformer’s Jump (and Wall Jump) | Unity
8:12
Мама и дневник Зомби (часть 1)🧟 #shorts
00:47