Honestly, even despite me making a completly different kind of third person controller, this helped me make my code modular, converted my code into the new input system, and organized it well. Hats off to you and thanks for the tutorials.
SOLVED movement and rotation input while falling after jump seems like right after the jump ends and starts falling there is a frame or two where movement and rotation input is registered i fixed this by adding an if statement check to the movement and rotation likewise: bottom of HandleMovement() if (isGrounded && !isJumping) { Vector3 movementVelocity = moveDirection; playerRigidbody.velocity = movementVelocity; } and bottom of HandleRotation() if (isGrounded && !isJumping) { transform.rotation = playerRotation; } looks like checking isInteracting isn't enough or my interacting bool isn't working properly
I am having this issue, but can't get your solution to work for me. In the frames that the animation switches from jump to fall, it reads the input and the player does a "double jump" in the horizontal direction if you are still holding 'W' OR the player just hits an invisible wall and falls if you stop holding 'W' before the frame that switches the animation. Also, if you swivel the camera around before the fall animation begins, it propels you towards the direction you are facing. EDIT: I see now! I was simply adding your lines of code, but now I realize that you have placed the already written code into the if statements and that DOES work! Many thanks :)
SOLVED: For anyone having the weird issue of flying super far forward anytime you are falling/jumping I know the problem: In PlayerLocomotion under HandleFallingAndLanding() is the line: "playerRigidBody.AddForce(transform.forward * leapingVelocity);" And this line will be called every frame that you are falling, so your rigid body will constantly be pushed forward until you are back on the ground. For some reason, my leaping velocity was set to 33, which is why I was flying forward really far, but all you need to do to fix this issue is lower that leaping velocity. I left mine at around 0.25-0.5. This will drastically minimize the amount that you fly forward when you fall/jump. You still want some value on it, as realistically there will be some slight forward movement when you are falling, especially if you fall/jump off a ledge while moving forward. Hope this can help someone!
This series is just exemplary! A proper from the ground up tutorial! Thank you so much, subbed! Came here for this, but now going to create new project for the Souls like playlist!
Hello! I've been working alongside the tutorial and have been getting good results! It's been allowing me to experiment and try different things and learn more about coding and I appreciate that as well as your efforts to makes these so easy to understand! That being said I have a question if anyone knows. When I press the jump the animation plays but the jumping force isn't applied. I have been following and have re-watched this a couple times but I can't seem to find my error. Any thoughts? Edit: I seemed to have gotten closer to my solution. Apparently my issue lies with the " playerRigidbody.velocity = movementVelocity;" in our HandleMovement() function. I think what is happening is that this velocity is being applied mid fixed update. So when I press jump/apply my force in my HandleJump() function it is immediately canceled out by the previous movement function, which has my rigidibody.velocity= movementDirection.y value = 0. I'm not sure what the work around to this could be. When I remove the line " playerRigidbody.velocity = movementVelocity;"" my jump works as expected but that completely removes my movement functionality. FINAL EDIT: I FIXED IT! So i took the line playerRigidbody.velocity = movementVelocity; in the MovementHandler() and added a prerequisite if statement. So i ended up with this as the solution: if (isGrounded && !isJumping) { Vector3 movementVelocity = moveDirection; playerRigidbody.velocity = movementVelocity; //this is the root of my jumping problem } This basically takes the rigidybody velocity adjustment and only applies it when the player is both grounded and is not jumping. Haven't ran into any additional bugs and hopefully it stays that way for a bit!
Thanks for this one you gave me the idea where to look. I solved mine differently by just adjusting the x and z velocity, to preserve what ever the y of playerRigidbody regardless of current action. Since the HandleMovement method only concerns x and z movement. {in the HandleMovement() method} instead of: playerRigidbody. velocity = movementVelocity; I adjusted it to: playerRigidbody.velocity = new Vector3(movementVelocity.x, playerRigidbody.velocity.y, movementVelocity.z); This way you can also solve the cancellation of jump input whenever your jumping. So far no bugs yet. Cheers!
I fixed it differently, I don't know if someone will prefer it this way, but I think it feels more realistic, since I was having a bug where I could change the direction the player was going to mid air when the falling anim started playing. What I did was: 1) At the start of the HandleMovement() I have an if that checks if (isJumping || !isGrounded) return, to avoid moving the player while jumping or falling. 2) Also, on the HandleJumping() I have after the jumpingVelocity definition: movementVelocity.y = jumpingVelocity; playerRigidbody.velocity = movementVelocity; This works wonders, now the momentum the player had before jumping or falling feels a lot more natural.
Hi Sebastion, I love you video I think you're doing great. But I have one question, if I wanted to make it so my momentum isn't locked when I jump what would I have to do?
heyo, ive really been enjoying these tutorials but I feel super stupid atm, and cant figure out how to let the player jump and move at the same time, unlike yours where you lock the movement while jumping, could you lend a hand at all ?
Just a reminder to ensure that the animations you use all end in the same position. I had a landing animation that made the model land in a negative y position, causing some weird clipping. I'm sure there's a way to fix it but i replaced my animation and that issue went away.
[SOLVED] 11:26 my character doesnt go forward when I press the "Up key" just uncheck "Apply root motion" in the animator.. fkin took me 2 days of sleep and procrastination to arrive at this somehow but ye it works
I know this is a long time since this videos upload, but I have been following the dark souls tutorials, I saw this video and wanted to implement this version of jumping. However once I implemented it my player does not move up or down, the animation plays but nothing else. How can I fix this problem.
Nice video! This 3rd person series seems to be using better systems than the dark souls series for some things which makes it desirable to refactor to but the more I do that the less compatible it becomes with the old system especially if we need those dependencies for later mechanics. As both series progress is the plan to update the souls series to work in tandem with this series or will the structure deviate more to the point these should be used more abstractly or as separate projects?
I wouldn't say the systems used here are "better". They are just more simplistic in design, and that allows for a much easier understanding! I am sure some features of the Souls series will see a refactor, however in the end the systems used on that series will differ very much from these. The only cross over would be the basic locomotion and Input systems. Cheers! :^)
I really appreciate the effort with this series. There are so many out there that just seem to twist off into frustration. I am experiencing a slight issue. When I jump, which is working great, the forward momentum isn't applied. I can be sprinting and hit jump and the character jumps straight up. All forward momentum stops. Same when I run off of an elevation. No forward momentum whatsoever. It's odd. Everything else seems to work like gangbusters. If anyone can shed some light, that would be super.
I was literally having a couple of issues, just to find in here by a random comment that i had to untick apply root motion, i know that you posted your comment a year ago but someone else might run into similar issues like i had. So to fix this just go in your Animator component and uncheck Apply root motion and that's basically it.
what edits and adjustments can i make to the script to have the character be able to move direction mid air? it feels clunky when im only being able to move 1 direction. Thanks :)
@@ShinStoopkid When you call the falling animation, pass false into PlayTargetAnimation and your usual movement logic should work fine. At the moment the 'IsInteracting' bool is preventing that logic from firing
Hey Sebastian. First off you are an amazing teacher. I am learning so much and its also incredibly fun. So thank you for that! Second I was wondering if this series will eventually cover combat, AI, Stats, Items, etc. I started with your Dark Souls tutorials and quickly found I was not able to keep up but then I found this. The slower pace is just what I needed. Thanks again for all your hard work and for making learning this stuff fun and accessible:) ps. As soon as I have stable income I'll be throwing my money at you on patreon lol.
I am very happy you are learning something from my content my friend :^) This series will unfortunately not cover any of these mentioned items, as I plan on doing other tutorials that will include those selections. (The Souls series already has most of that)
Hey I'm aware this is an older video and you might not see this, but I started taking Unity courses a couple months ago and felt like I was getting nowhere until I started watching your videos. I feel like I'm learning much better and at a faster rate. I've only had 1 issue with Unity that I have no idea how to solve which is: (When I have my animation states (jump, falling, land) I'm only able to run 1 single transition from them. So I can't run the the transition from jump to empty to run the check to see if the character isGrounded or not to revert to default animations) again thanks so much for these videos!
Hey :) this is an update issue, i'm pretty sure your unity is in version 2020.3.32f1 you must update it to 2020.3.33f1 (the lastest version today) doing the update will allow you to create many transitions from one action.
Two years old video and still extremely helphul! Thank you so much. Still, i have a problem :D my boy( player character) jumps only in place and dous not keep the forward velocity.Might be a animations setting problem. Do you have any suggestion that would sove the problem?
I wanna know if anybody else is having this same problem and especially if they know how to fix it but my isInteracting and isJumping bools don't reset and I have no idea how to fix it
(Making new comment for better visibility) Below I asked the question on how to solve the problem of the character gently gliding down slopes (not enough height to begin falling). This issue seems to be more prevalent when trying to go down a set of stairs at say 25 degrees. The character will start falling down the stairs instead of running down them normally. I came up with a solution, but I’m sure Sebastian could come up with something far more elegant and efficient. However, in case other people are interested, I came up with the following solution by raycasting to the ground and seeing if the angle exceeds a certain threshold. Then apply a downward force. private bool CheckForSlope() { if (isJumping) { return false; } RaycastHit hit; if (Physics.Raycast(transform.position, Vector3.down, out hit, GetComponent().height * slopeForceRayLength)) {
// If the hit does not return a Vector 3 of 0.1.0 then we know its on a slope. if (hit.normal != Vector3.up) { // Now to get the angle of the slope. If its less than say -10 degrees then we are going down a slope. (-10 to 0 is still a downward // slope but not enough that I would want to apply a full downward force on the player. float slopeAngle = Vector3.Angle(hit.normal, transform.forward) - 90;
if (slopeAngle < slopeAngleThreshold) { return true; } } } return false; } Then in the HandleMovement method, just after applying velocity to the rigidbody, add the following: // Check to see if we need to apply downward force if moving along a slope. if ((inputManager.horizontalInput != 0.0f || inputManager.verticalInput != 0.0f) && CheckForSlope()) { rigidBody.AddForce(Vector3.down * downwardForce); } Finally, additional variables to be added at the top: [Header("Slope")] public float downwardForce = 120; // Experiment with values while going down slopes. public float slopeForceRayLength = -1.5; public float slopeAngleThreshold = 10.0f; // The angle that the slope needs to exceed before downward force is applied. I hope this is of some help to people.
Hey, :) for those who can't create many transitions from an action you must update your unity to 2020.3.33f1 (the lastest version today) to fix this. it's an update issue from the previous version 2020.3.32f1.
Anyone having the issue where you barely move on a jump (even if you hold down move/sprint key) click the player (gameobject) and look at the Animator in the Inspector Window and make sure Apply Root Motion is unchecked.
Great video, love the series. I know this is going to be a long shot, but worth a try. Got everything working following step by step except the forward movement during the jump. My player does not move forward, just goes up and down, even if I hold forward input. Any ideas?
I have the same issue, did you find a solution yet? seems like the Rigidbody does not takes the movement and just the y axis from the jump but i have no Idea how to fix it
@@indraotsusukii8039 Hey! I believe the movement in air after jumping was solved by adding if (isJumping) return; to the top of HandleMovement() on the PlayerLocomotion script. This is shorthand. I also added this to my HandleRotation() and HandleRoll() functions so that the player isn't able to apply any movement, rotation, or roll while the isJumping bool is set to true. Does that help?
Very nice tutorial! Thank you! 1 issue I found is when your running and run into a cube then hit jump, the player will get stuck in isGrounded and isJumping. They wont move or jump after that. You have to stop moving, then manually uncheck isGrounded in the inspector for the player character to reset. I added animatorManager.animator.SetBool("isGrounded", false); //added due to getting stuck when jumping around blocks isGrounded = false; to the bottom of the PlayerLocomotion, HandleJumping() function and it seems to have fixed it, but there may be a better way.
Alright my only problem is that if I jump on a slope facing downwards, then my player goes shooting straight slidin off in the distance. How can i stop that?
If anyone is having an issue where they have no forward momentum while jumping (jumping straight up in the air) try turning off root motion in the players animator component. I dont know if this makes a difference but I also changed HandleJumping() in the PlayerLocomotion script to look like this: public void HandleJumping() { if (isGrounded) { animatorManager.animator.SetBool("isJumping", true); animatorManager.PlayTargetAnimation("Jump", false); float jumpingVelocity = Mathf.Sqrt(-2 * gravityIntensity * jumpHeight); // Preserve the current horizontal velocity and apply jump velocity to the y-component Vector3 playerVelocity = playerRigidbody.velocity; playerVelocity.y = jumpingVelocity; playerRigidbody.velocity = playerVelocity; } }
Another brilliant tutorial Sebastian!!! I truly appreciate the work you are putting into these lessons and finding different ways to accomplish tasks that you did in the Dark Souls series. I like your implementation of falling, landing and jumping in this series better than the Dark Souls series. My only complaint is I have to wait 3 more weeks before the next video. 😪
everything works so far, but after jump input, after it lands, it shows isGrounded = true; and keeps isJumping = true; it doesnt change isJumping to false after it lands. what can be issue? i cant figure out what overrides it in animator to keep it true?
I keep having problems with the jump system, where I can jump multiple times, even in the air. Does anyone know how to fix this, to make me jump only once when I touch the ground?
theres a moment between jumping and falling where my controller can effect the direction so im tryina figure that out and will recomment with solution if no ones got one
I see this as well, but no luck finding a solution yet. @Hristo Borisov seemed to implement a fix in their game, but it didn't work for me. Did you have any luck? EDIT: Take a look at @Hristo Borisov comment. They added if statements to the HandleMovement() and HandleRotation() functions and this worked for me. Just need to tweak some other variables to make it look a little smoother now.
HEllo, not sure if anyone can help but after jumping i can no long more on the XZ axis, I just run in place. Im not sure what is happening. I have root motion unchecked as well but this has not resolved the issue. before jumping he is able to run but after jumping he cannot.
Hello, Great tutorial, but I've run into an issue. Whenever I jump, my player's x and z velocity are completely canceled. I've used debug.log and the values are still there, but for some reason, they are not being applied to playerRigidbody.velocity. Is this a known issue?
@@imconfused6955 This helped with my issue slightly! I'm having a similar problem where after jumping I only move in a straight line. Unchecking apply root motion makes it so my character just runs on the spot
Hi, thanks for the tutorials! I'm havnig a problem. My character is playing the jump animation, the velocity is increasing on the y axis, but the character is not moving. Just standing in place and playing the jump animation 😰
UPDATE: Those having this issue it is caused by the "if(isJumping) return" not being present in the HandleMovement() method. Add that back in and you're golden.
I appreciate the tutorials, but it would be nice if a bit more planning was going into the engineering, as you seem to be using a philosophy of "if I need something I will make it public", which is really bad practice.
Can pls someone help me? I have Root Motion unchecked, I rewatched the video a coupl3 of times but and the code is right. So my problem is, when I jump, the character moves forward. Maybe I am dumb but I did not find solution reading the comments.
Very good tutorial so far. Great job. My hope is that you continue the series. Something I have noticed and I'm hoping it's not me not setting this up correctly. I placed a set of stairs in my scene. Going up doesn't seem to have any issues. Going down however. If I walk, the character doesn't walk down the slope, but rather sort of hovers and then gradually lowers down to the slope. If I run, then the character sort of lauches herself forward and falls down the stairs. Even lowering the leapVelocity doesn't seem to stop this. I suspect this has something to do with moveDirection.y = 0.0f interfering with gravity letting the character naturally walk downwards. Anyway, thanks alot for everything so far. It's been very helpful.
@@SebastianGraves That would be greatly appreciated. I've been trying to do a workaround but haven't been able to quite nail it. I'm sure others would benefit if you have a solution. Many thanks.
Is there any way at all to allow movement during the falling/jumping? EDIT: I figured it out - it's not perfect, rotation/movement is a little snappy, but the solution has no noticeable problems so far. To allow movement being enabled you just have to remove the !isGrounded checks at the bottom of HandleMovement(); and HandleRotation();. Then, in the HandleAllMovement();, just duplicate HandleMovement(); and HandleRotation();, but put it inside of an isInteracting if statement. Make another if statement inside and check for !isGrounded, and use else to return if isGrounded. This should, in theory (and from the results I've received), separate movement between Jumping and normal movement, but both of them still utilizing the same functionality at the same time. Best of both worlds. Hope this helps someone.
thank you your share. But you mean is this function right ? public void HandleAllMovement() { HandFallingAndLanding(); HandleMovement(); //to be countinues..... if (playerManager.isInteracting) { if (!isGround) { HandleRotation(); HandleMovement(); } else { return; } } //if (isJumping) //return; HandleRotation(); }
It works well, but when I want to allow movement in the air, I commented HandleMovement() condition, /* if (isJumping) return; */ then the player can't jump, any ideas?
Hi there, I love these tutorials! I am having an issue where my player is getting stuck in the "Faling" state and animation. Any idea what might be causing this?
@@SebastianGraves Hi Sebastian. I got it all working with the logic system attached for the animator. Is this set up correctly? Yes, the isGrounded is now resetting in the animator: drive.google.com/file/d/1p3Fm2efroj3eAqg_kx1WMGqz4TJVwC9S/view?usp=sharing
I keep getting an error message of null reference exception: object reference not set to an instance of an object. This is on the input handler HandleJumpInput, playerLocomotion.HandleJumping();
I have a bug and for the life of me I can't figure out how to fix it. As soon as I hit play, the character jumps once without any input, comes down but doesn't touch the ground. It's stuck in the falling animation, hovering the ground. isInteracting doesn't get reset since the character doesnt hit empty state, so I can't do anything. If I manually set it in play mode the character instantly jumps again. I have no idea why the charater jumps on his own, since playerControls define spacebar as input.
@@strucep Mh, I already had that. What fixed it for me was adding the jump bool the HandleJumping() and in HandleJumpInput() changing the order of the statements, so the bool is set to false after the method has been called. But now the jump is a bit wanky. Seems to lose forward velocity pretty fast as soon as the character is in the air. When the falling animation plays he just falls down without any forward movement.
Just finished going thru this tutorial... something strange though ... when I hit play my character immediately starts jumping without pressing any key ...falls a bit not to ground and jumps again in mid air ... this cycle keeps happening as the character gets higher and higher .... can anyone point me in the right direction to start debugging it?
I am unsure if you managed to fix this problem but if you go to your animation in the in your animation folder then click on the original you should be able to turn it into a humanized animation. Once done copy it by clicking Ctrl+D then click on the copy one and tick loop time, and bake into pose :)
Managing variables from animations is a bad idea that will bite you sooner or later. At least use triggers that will update variable in a class. Also, store strings for animation names in one place as public static string and refer only to these static, do not use raw strings in your code!
An excellent tutorial! Just one thing is not going so smoothly which is the transition into the falling animation - it takes a second for it to go from falling to landing. I'm just wondering if anyone else has encountered this problem and knows how to fix it.
Hello! The tutorial is good and I was able to get it to work but there were some issues with unity going between computers and now I’m experiencing some problems. The jumping is for the most part working fine but I am no longer able to move normally, and isInteracting is constantly on unless its playing the jumping animation. Does anyone know how to fix this? Ive gone through this and the previous video and havent been able to find a way
Does your animation have upward root motion by any chance? If so, are you enabling root motion during the falling animation? You can check this using Debug.log :^)
@@SebastianGraves Thank you for taking the time to reply! It seems all of my animation clips say "Root contains root motion curves" Is that what you're referring to? If I reimport the animations and change to None on the root motion, I see the option to adjust the Root Transform Position (Y), but I can't seem to find a combination that makes it look and feel any better. I'm honestly not sure how I'd go about using Debug.Log to tell if it's being enabled or not. Working on that now though and I will report back.
@@garybuchert7005 Hey Gary! Root motion essentially moves the character with the animations movements, instead of moving it with code. For jumping and falling in this project we do not want this. You can use an animation that uses root motion, but disable the root motion via script. You can check if your animator is using root motion, by referencing the animator variable like this! Debug.Log(animator.applyRootMotion); If the console says "True". You are using Root Motion. If it says "False". You are not! If you are not using root motion, but you are still getting some movement oddities, check for odd collisions between colliders or perhaps a mistake in the code. Good luck my friend :^)
@@SebastianGraves Hmm strange. The console is telling me "False". I've reimported the jump, fall, and land animations and updated Root Motion Node to on the FBX file before duplicating the animation clips. There is still a very slight upward boost when transitioning from jump to fall, but I'm also now noticing that my jump is moving the player forward without me holding 'W' which tells me that root motion is still enabled somehow? Think I'm going to call it for the day and come back tomorrow with fresh eyes. Thank you again for taking a look with me!
@@SebastianGraves Yea, has to be in the code or collisions because I removed the animation and the little boost still seems to be there. Thanks again for pointing me in the right direction!
PLEEEAAAASE... Make a tutorial on VAULT and CLIMBING system with your 3rd person controller... I tried to ajust others tutorials on climbing and vaulting with this one and it doesn't work... I'm dying bro... Please do something...
hey thank you for the series :) so, i don't know if i should ask this or not but can you tell how to switch players like in lost ember like i want to have a main character say ((X )) but want that to possess different other temporary characters = Y,Z,A ,etc. and when i return i want the main character to reappear. i am a beginner and have absolutely no idea what is going on with my project so any help is greatly appreciated .
Thanks a lot this is my first time doing coding but it all worked out good but I want to tweak it so that i can move while jumping and so that the movement and rotation is not restricted.
Hey i know this tutorial is old but i have done literally everything in this video and i can't jump, my isJumping is ticking but jump_input isn't ticking and my character isn't jumping at all, my characterRigibody.velocity isn't doing anything, does anyone know any fix?
Honestly, even despite me making a completly different kind of third person controller, this helped me make my code modular, converted my code into the new input system, and organized it well. Hats off to you and thanks for the tutorials.
SOLVED movement and rotation input while falling after jump
seems like right after the jump ends and starts falling there is a frame or two where movement and rotation input is registered
i fixed this by adding an if statement check to the movement and rotation likewise:
bottom of HandleMovement()
if (isGrounded && !isJumping)
{
Vector3 movementVelocity = moveDirection;
playerRigidbody.velocity = movementVelocity;
}
and bottom of HandleRotation()
if (isGrounded && !isJumping)
{
transform.rotation = playerRotation;
}
looks like checking isInteracting isn't enough or my interacting bool isn't working properly
You are the best man, thank you so much !!!!
@@andreistandima
I am having this issue, but can't get your solution to work for me. In the frames that the animation switches from jump to fall, it reads the input and the player does a "double jump" in the horizontal direction if you are still holding 'W' OR the player just hits an invisible wall and falls if you stop holding 'W' before the frame that switches the animation. Also, if you swivel the camera around before the fall animation begins, it propels you towards the direction you are facing.
EDIT: I see now! I was simply adding your lines of code, but now I realize that you have placed the already written code into the if statements and that DOES work! Many thanks :)
@@garybuchert7005 glad it helped
Even after a year, your comment is helping people out! Thank you so much for this! Exactly what I was looking for
Isn't working as intended for me. When I am jumping there is no height in the jump and after the jump the rotation still doesn't work for me
Edit: turns out i just needed to make sure the animation name was correct. It should be "Jump" not anything else
same problem here
SOLVED: For anyone having the weird issue of flying super far forward anytime you are falling/jumping I know the problem:
In PlayerLocomotion under HandleFallingAndLanding() is the line:
"playerRigidBody.AddForce(transform.forward * leapingVelocity);"
And this line will be called every frame that you are falling, so your rigid body will constantly be pushed forward until you are back on the ground. For some reason, my leaping velocity was set to 33, which is why I was flying forward really far, but all you need to do to fix this issue is lower that leaping velocity. I left mine at around 0.25-0.5. This will drastically minimize the amount that you fly forward when you fall/jump. You still want some value on it, as realistically there will be some slight forward movement when you are falling, especially if you fall/jump off a ledge while moving forward.
Hope this can help someone!
Thank you.
Just need to work in reduced in air control now, thanks for all your work making these!
Your effort is honorable..
:)
When i attempt jump it plays the animation but my character barely moves, sometimes doesnt move at all.
Same
same
This series is just exemplary! A proper from the ground up tutorial! Thank you so much, subbed! Came here for this, but now going to create new project for the Souls like playlist!
Glad you enjoyed it my friend!
Truly inspiring work! As a beginner, watching your approach to unity and c# is such a huge help, thanks for being an awesome teacher
I am very happy you can learn from my series my friend.
@@SebastianGravesCan you do sliding next please (and if you can)
I am having an issue despite doing the code correctly. Even if My character jump in place, falling and landing animation occurs, so how do I solve it?
Hey how can i enable moving while jumping?
Hello! I've been working alongside the tutorial and have been getting good results! It's been allowing me to experiment and try different things and learn more about coding and I appreciate that as well as your efforts to makes these so easy to understand!
That being said I have a question if anyone knows. When I press the jump the animation plays but the jumping force isn't applied. I have been following and have re-watched this a couple times but I can't seem to find my error. Any thoughts?
Edit: I seemed to have gotten closer to my solution. Apparently my issue lies with the " playerRigidbody.velocity = movementVelocity;" in our HandleMovement() function. I think what is happening is that this velocity is being applied mid fixed update. So when I press jump/apply my force in my HandleJump() function it is immediately canceled out by the previous movement function, which has my rigidibody.velocity= movementDirection.y value = 0.
I'm not sure what the work around to this could be. When I remove the line " playerRigidbody.velocity = movementVelocity;"" my jump works as expected but that completely removes my movement functionality.
FINAL EDIT: I FIXED IT!
So i took the line playerRigidbody.velocity = movementVelocity; in the MovementHandler() and added a prerequisite if statement.
So i ended up with this as the solution:
if (isGrounded && !isJumping)
{
Vector3 movementVelocity = moveDirection;
playerRigidbody.velocity = movementVelocity; //this is the root of my jumping problem
}
This basically takes the rigidybody velocity adjustment and only applies it when the player is both grounded and is not jumping. Haven't ran into any additional bugs and hopefully it stays that way for a bit!
Thanks for this one you gave me the idea where to look. I solved mine differently by just adjusting the x and z velocity, to preserve what ever the y of playerRigidbody regardless of current action. Since the HandleMovement method only concerns x and z movement.
{in the HandleMovement() method}
instead of:
playerRigidbody. velocity = movementVelocity;
I adjusted it to:
playerRigidbody.velocity = new Vector3(movementVelocity.x, playerRigidbody.velocity.y, movementVelocity.z);
This way you can also solve the cancellation of jump input whenever your jumping. So far no bugs yet. Cheers!
Thanks for posting this! it's giving me some partial fixes for the same problem (:
Thank you for your help. Really appreciate it :)
@@noicenoise8718 legend thank you
I fixed it differently, I don't know if someone will prefer it this way, but I think it feels more realistic, since I was having a bug where I could change the direction the player was going to mid air when the falling anim started playing.
What I did was:
1) At the start of the HandleMovement() I have an if that checks if (isJumping || !isGrounded) return, to avoid moving the player while jumping or falling.
2) Also, on the HandleJumping() I have after the jumpingVelocity definition:
movementVelocity.y = jumpingVelocity;
playerRigidbody.velocity = movementVelocity;
This works wonders, now the momentum the player had before jumping or falling feels a lot more natural.
Thank you for your time and effort to help others!
For anyone struggling with not being able to move forward while jumping, try unchecking apply root motion on the animator.
In what place
@@CanalGenericojsjs on the component not on the animator window
thank you it worked for me
@@kazakturku5885 no problem!
Hi Sebastion, I love you video I think you're doing great.
But I have one question, if I wanted to make it so my momentum isn't locked when I jump what would I have to do?
heyo, ive really been enjoying these tutorials but I feel super stupid atm, and cant figure out how to let the player jump and move at the same time, unlike yours where you lock the movement while jumping, could you lend a hand at all ?
Did you find a solition for it?
???
As always, magnificent work. Looking forward to the next video.
Just a reminder to ensure that the animations you use all end in the same position. I had a landing animation that made the model land in a negative y position, causing some weird clipping. I'm sure there's a way to fix it but i replaced my animation and that issue went away.
for future, you can tell everyone that tones of animations are on Mixamo from Adobe and all are for free use for everything ! :D
[SOLVED] 11:26 my character doesnt go forward when I press the "Up key"
just uncheck "Apply root motion" in the animator.. fkin took me 2 days of sleep and procrastination to arrive at this somehow but ye it works
@William Coleman in the animator component
@@shazboi hi man, could you add your files to github or something? My character just does not jump whatever i try
@@henkiespenkie4414 Hey man I am sorry for the really late reply, yeah I kinda have more bugs in the jumping thing soooo even my code isn't correct ig
@@shazboi Its on the inspector while having the LowPolyMan object selected.. on the animator component inside the low poly man :v
@@draicor omg, that solved my falling and jumping forward velocity when the w key is hit! Before it did nothing to the forward velocity.
I know this is a long time since this videos upload, but I have been following the dark souls tutorials, I saw this video and wanted to implement this version of jumping. However once I implemented it my player does not move up or down, the animation plays but nothing else. How can I fix this problem.
I know its been a while but any chance you figured this out?
Nice video! This 3rd person series seems to be using better systems than the dark souls series for some things which makes it desirable to refactor to but the more I do that the less compatible it becomes with the old system especially if we need those dependencies for later mechanics. As both series progress is the plan to update the souls series to work in tandem with this series or will the structure deviate more to the point these should be used more abstractly or as separate projects?
I wouldn't say the systems used here are "better". They are just more simplistic in design, and that allows for a much easier understanding!
I am sure some features of the Souls series will see a refactor, however in the end the systems used on that series will differ very much from these. The only cross over would be the basic locomotion and Input systems.
Cheers! :^)
I really appreciate the effort with this series. There are so many out there that just seem to twist off into frustration. I am experiencing a slight issue. When I jump, which is working great, the forward momentum isn't applied. I can be sprinting and hit jump and the character jumps straight up. All forward momentum stops. Same when I run off of an elevation. No forward momentum whatsoever. It's odd. Everything else seems to work like gangbusters. If anyone can shed some light, that would be super.
I was literally having a couple of issues, just to find in here by a random comment that i had to untick apply root motion, i know that you posted your comment a year ago but someone else might run into similar issues like i had. So to fix this just go in your Animator component and uncheck Apply root motion and that's basically it.
You were right. Thank youu ^^@@klevialushi571
could this TPS controller be use for commercial use?
what edits and adjustments can i make to the script to have the character be able to move direction mid air? it feels clunky when im only being able to move 1 direction. Thanks :)
Did you ever find the answer out to this?
@@ShinStoopkid When you call the falling animation, pass false into PlayTargetAnimation and your usual movement logic should work fine. At the moment the 'IsInteracting' bool is preventing that logic from firing
Hey Sebastian. First off you are an amazing teacher. I am learning so much and its also incredibly fun. So thank you for that! Second I was wondering if this series will eventually cover combat, AI, Stats, Items, etc. I started with your Dark Souls tutorials and quickly found I was not able to keep up but then I found this. The slower pace is just what I needed.
Thanks again for all your hard work and for making learning this stuff fun and accessible:)
ps. As soon as I have stable income I'll be throwing my money at you on patreon lol.
I am very happy you are learning something from my content my friend :^)
This series will unfortunately not cover any of these mentioned items, as I plan on doing other tutorials that will include those selections. (The Souls series already has most of that)
@@SebastianGraves Dope! You're the best and I'm stoked to graduate to the Souls series when I get there!
Only 18 hours can’t wait
Thanks for the great tutorial! I made a super jump and played Morpheus jumping for ten minutes😆
Hey I'm aware this is an older video and you might not see this, but I started taking Unity courses a couple months ago and felt like I was getting nowhere until I started watching your videos. I feel like I'm learning much better and at a faster rate. I've only had 1 issue with Unity that I have no idea how to solve which is:
(When I have my animation states (jump, falling, land) I'm only able to run 1 single transition from them. So I can't run the the transition from jump to empty to run the check to see if the character isGrounded or not to revert to default animations) again thanks so much for these videos!
Hey :) this is an update issue, i'm pretty sure your unity is in version 2020.3.32f1 you must update it to 2020.3.33f1 (the lastest version today) doing the update will allow you to create many transitions from one action.
My character barely move to jump... how do I fix this?
Two years old video and still extremely helphul! Thank you so much.
Still, i have a problem :D my boy( player character) jumps only in place and dous not keep the forward velocity.Might be a animations setting problem. Do you have any suggestion that would sove the problem?
when i press jump button then player jump but animation have little delay. when player is mid air then animation is playing. help me fix
anyway to make the jump less floaty?
Dose any know why my character could stay in Jumping condition? If I jump once, it will be lock in a strange condition. And no Error information...
I wanna know if anybody else is having this same problem and especially if they know how to fix it but my isInteracting and isJumping bools don't reset and I have no idea how to fix it
(Making new comment for better visibility)
Below I asked the question on how to solve the problem of the character gently gliding down slopes (not enough height to begin falling). This issue seems to be more prevalent when trying to go down a set of stairs at say 25 degrees. The character will start falling down the stairs instead of running down them normally.
I came up with a solution, but I’m sure Sebastian could come up with something far more elegant and efficient. However, in case other people are interested, I came up with the following solution by raycasting to the ground and seeing if the angle exceeds a certain threshold. Then apply a downward force.
private bool CheckForSlope()
{
if (isJumping)
{
return false;
}
RaycastHit hit;
if (Physics.Raycast(transform.position, Vector3.down, out hit, GetComponent().height * slopeForceRayLength))
{
// If the hit does not return a Vector 3 of 0.1.0 then we know its on a slope.
if (hit.normal != Vector3.up)
{
// Now to get the angle of the slope. If its less than say -10 degrees then we are going down a slope. (-10 to 0 is still a downward
// slope but not enough that I would want to apply a full downward force on the player.
float slopeAngle = Vector3.Angle(hit.normal, transform.forward) - 90;
if (slopeAngle < slopeAngleThreshold)
{
return true;
}
}
}
return false;
}
Then in the HandleMovement method, just after applying velocity to the rigidbody, add the following:
// Check to see if we need to apply downward force if moving along a slope.
if ((inputManager.horizontalInput != 0.0f || inputManager.verticalInput != 0.0f) && CheckForSlope())
{
rigidBody.AddForce(Vector3.down * downwardForce);
}
Finally, additional variables to be added at the top:
[Header("Slope")]
public float downwardForce = 120; // Experiment with values while going down slopes.
public float slopeForceRayLength = -1.5;
public float slopeAngleThreshold = 10.0f; // The angle that the slope needs to exceed before downward force is applied.
I hope this is of some help to people.
Thanks very much for this couse, its great to learn new Input system and all about third person controller.
Thanks again for all your work. Are there any specific paid animation assets you'd feel comfortable recommending?
Hey, :) for those who can't create many transitions from an action you must update your unity to 2020.3.33f1 (the lastest version today) to fix this.
it's an update issue from the previous version 2020.3.32f1.
Love you Luci! 💡
Anyone having the issue where you barely move on a jump (even if you hold down move/sprint key) click the player (gameobject) and look at the Animator in the Inspector Window and make sure Apply Root Motion is unchecked.
Great video, love the series. I know this is going to be a long shot, but worth a try. Got everything working following step by step except the forward movement during the jump. My player does not move forward, just goes up and down, even if I hold forward input. Any ideas?
:)
not really, could be the booleans arent setup properly, best advice is to rewatch and look for mistakes you've made
I have the same issue, did you find a solution yet?
seems like the Rigidbody does not takes the movement and just the y axis from the jump
but i have no Idea how to fix it
same here
For anyone having issues with not being able to move forward while jumping or falling uncheck 'Apply Root Motion'.
I have a bug with that design. if u press jump and then try to move, you can see that person change movement direction in air
Same, trying to solve this as well. Did you have any luck implementing a fix?
@@garybuchert7005 Did you have any luck implementing a fix?
@@indraotsusukii8039 Hey! I believe the movement in air after jumping was solved by adding
if (isJumping) return;
to the top of HandleMovement() on the PlayerLocomotion script. This is shorthand. I also added this to my HandleRotation() and HandleRoll() functions so that the player isn't able to apply any movement, rotation, or roll while the isJumping bool is set to true.
Does that help?
Very nice tutorial! Thank you!
1 issue I found is when your running and run into a cube then hit jump, the player will get stuck in isGrounded and isJumping. They wont move or jump after that. You have to stop moving, then manually uncheck isGrounded in the inspector for the player character to reset.
I added
animatorManager.animator.SetBool("isGrounded", false); //added due to getting stuck when jumping around blocks
isGrounded = false;
to the bottom of the PlayerLocomotion, HandleJumping() function and it seems to have fixed it, but there may be a better way.
Alright my only problem is that if I jump on a slope facing downwards, then my player goes shooting straight slidin off in the distance. How can i stop that?
If you have the find the solution for this problem then please share it with me
If anyone is having an issue where they have no forward momentum while jumping (jumping straight up in the air) try turning off root motion in the players animator component.
I dont know if this makes a difference but I also changed HandleJumping() in the PlayerLocomotion script to look like this:
public void HandleJumping()
{
if (isGrounded)
{
animatorManager.animator.SetBool("isJumping", true);
animatorManager.PlayTargetAnimation("Jump", false);
float jumpingVelocity = Mathf.Sqrt(-2 * gravityIntensity * jumpHeight);
// Preserve the current horizontal velocity and apply jump velocity to the y-component
Vector3 playerVelocity = playerRigidbody.velocity;
playerVelocity.y = jumpingVelocity;
playerRigidbody.velocity = playerVelocity;
}
}
even the paid asset templates have bad jump mechanic... this is excellent...
Another brilliant tutorial Sebastian!!! I truly appreciate the work you are putting into these lessons and finding different ways to accomplish tasks that you did in the Dark Souls series. I like your implementation of falling, landing and jumping in this series better than the Dark Souls series. My only complaint is I have to wait 3 more weeks before the next video. 😪
everything works so far, but after jump input, after it lands, it shows isGrounded = true; and keeps isJumping = true;
it doesnt change isJumping to false after it lands. what can be issue? i cant figure out what overrides it in animator to keep it true?
nevermind after 3 hours i figured that ResetIsJumping script isn't attached to jump animation in animator... *facepalm*
I keep having problems with the jump system, where I can jump multiple times, even in the air.
Does anyone know how to fix this, to make me jump only once when I touch the ground?
My character always seems to be about 0.2 of the ground
enjoying the vids
theres a moment between jumping and falling where my controller can effect the direction so im tryina figure that out and will recomment with solution if no ones got one
I see this as well, but no luck finding a solution yet. @Hristo Borisov seemed to implement a fix in their game, but it didn't work for me. Did you have any luck?
EDIT: Take a look at @Hristo Borisov comment. They added if statements to the HandleMovement() and HandleRotation() functions and this worked for me. Just need to tweak some other variables to make it look a little smoother now.
HEllo, not sure if anyone can help but after jumping i can no long more on the XZ axis, I just run in place. Im not sure what is happening. I have root motion unchecked as well but this has not resolved the issue. before jumping he is able to run but after jumping he cannot.
Can anyone help me please? Everytime I press the space botton, my character just fly into the sky and never fall. Why would that happen?
I have the same problem
Any hint on when and what the next episode will be about?
Hello, Great tutorial, but I've run into an issue. Whenever I jump, my player's x and z velocity are completely canceled. I've used debug.log and the values are still there, but for some reason, they are not being applied to playerRigidbody.velocity. Is this a known issue?
Nevermind, I got it. The solution was to uncheck "apply Root Motion on the animator." A very simple fix, easily overlooked.
Thanks man this was really helpful
lol, thanks UwU
@@imconfused6955 This helped with my issue slightly! I'm having a similar problem where after jumping I only move in a straight line. Unchecking apply root motion makes it so my character just runs on the spot
@@Akovor_ did you get it to work? im having the same issue...
awesome tutorial, hoping you gonna implement more features in the future!
Hi, thanks for the tutorials! I'm havnig a problem. My character is playing the jump animation, the velocity is increasing on the y axis, but the character is not moving. Just standing in place and playing the jump animation 😰
UPDATE: Those having this issue it is caused by the "if(isJumping) return" not being present in the HandleMovement() method. Add that back in and you're golden.
Can you add sprint jumping
I appreciate the tutorials, but it would be nice if a bit more planning was going into the engineering, as you seem to be using a philosophy of "if I need something I will make it public", which is really bad practice.
pls continue this series
Is getter/setter and serializedfield good for unity? My eyes is bleeding from seeing to many public field lol
My character doesn't move vertically when I jump, the animation works, but it doesn't go up, anyone can help?
the movement flag of is jumping doesn't get checked when I click on the jump button
Can pls someone help me? I have Root Motion unchecked, I rewatched the video a coupl3 of times but and the code is right. So my problem is, when I jump, the character moves forward. Maybe I am dumb but I did not find solution reading the comments.
When I jump the player jumps pretty high, and he keeps jumping
Very good tutorial so far. Great job. My hope is that you continue the series. Something I have noticed and I'm hoping it's not me not setting this up correctly. I placed a set of stairs in my scene. Going up doesn't seem to have any issues. Going down however. If I walk, the character doesn't walk down the slope, but rather sort of hovers and then gradually lowers down to the slope. If I run, then the character sort of lauches herself forward and falls down the stairs. Even lowering the leapVelocity doesn't seem to stop this. I suspect this has something to do with moveDirection.y = 0.0f interfering with gravity letting the character naturally walk downwards. Anyway, thanks alot for everything so far. It's been very helpful.
I can do a video on stairs and slopes if you'd like :^)
@@SebastianGraves That would be greatly appreciated. I've been trying to do a workaround but haven't been able to quite nail it. I'm sure others would benefit if you have a solution. Many thanks.
@@SebastianGraves I put ramps in my scene and would like to see how you handle making the player stick to stairs/ramps.
@@SebastianGraves Yes please, I've been itching to ask that. Btw thanks so much for your lessons :>
Is there any way at all to allow movement during the falling/jumping?
EDIT: I figured it out - it's not perfect, rotation/movement is a little snappy, but the solution has no noticeable problems so far. To allow movement being enabled you just have to remove the !isGrounded checks at the bottom of HandleMovement(); and HandleRotation();.
Then, in the HandleAllMovement();, just duplicate HandleMovement(); and HandleRotation();, but put it inside of an isInteracting if statement. Make another if statement inside and check for !isGrounded, and use else to return if isGrounded.
This should, in theory (and from the results I've received), separate movement between Jumping and normal movement, but both of them still utilizing the same functionality at the same time. Best of both worlds. Hope this helps someone.
thank you your share. But you mean is this function right ?
public void HandleAllMovement()
{
HandFallingAndLanding();
HandleMovement();
//to be countinues.....
if (playerManager.isInteracting)
{
if (!isGround)
{
HandleRotation();
HandleMovement();
}
else
{
return;
}
}
//if (isJumping)
//return;
HandleRotation();
}
It works well, but when I want to allow movement in the air, I commented HandleMovement() condition,
/*
if (isJumping)
return;
*/
then the player can't jump, any ideas?
Have you been able to solve it?
@@indraotsusukii8039 did you?
Hi there, I love these tutorials!
I am having an issue where my player is getting stuck in the "Faling" state and animation. Any idea what might be causing this?
Is your ground check resetting? :^)
@@SebastianGraves Hi Sebastian. I got it all working with the logic system attached for the animator. Is this set up correctly? Yes, the isGrounded is now resetting in the animator:
drive.google.com/file/d/1p3Fm2efroj3eAqg_kx1WMGqz4TJVwC9S/view?usp=sharing
@@AaronAsherRandall I don't have the 'isInteracting' condition between 'Land' and 'Empty' and mine is working, so maybe it's that?
I keep getting an error message of null reference exception: object reference not set to an instance of an object. This is on the input handler HandleJumpInput, playerLocomotion.HandleJumping();
same here did you find a fix?
figured it out, add playerLocomotion = GetComponent(); to your input manager in the Awake method
I have a bug and for the life of me I can't figure out how to fix it. As soon as I hit play, the character jumps once without any input, comes down but doesn't touch the ground. It's stuck in the falling animation, hovering the ground. isInteracting doesn't get reset since the character doesnt hit empty state, so I can't do anything. If I manually set it in play mode the character instantly jumps again. I have no idea why the charater jumps on his own, since playerControls define spacebar as input.
@@strucep Mh, I already had that. What fixed it for me was adding the jump bool the HandleJumping() and in HandleJumpInput() changing the order of the statements, so the bool is set to false after the method has been called. But now the jump is a bit wanky. Seems to lose forward velocity pretty fast as soon as the character is in the air. When the falling animation plays he just falls down without any forward movement.
Just finished going thru this tutorial... something strange though ... when I hit play my character immediately starts jumping without pressing any key ...falls a bit not to ground and jumps again in mid air ... this cycle keeps happening as the character gets higher and higher .... can anyone point me in the right direction to start debugging it?
I am unsure if you managed to fix this problem but if you go to your animation in the in your animation folder then click on the original you should be able to turn it into a humanized animation. Once done copy it by clicking Ctrl+D then click on the copy one and tick loop time, and bake into pose :)
Great tutorial as always, please do rolling action at the same button as run on the next one please! i beg on you!!!
I think there's a bunch of videos on rolling actions in his Redo Dark Souls series, and if I recall correctly there was one on that very thing.
enjoy your videos, it really help me alot. thank you
it doesnot go forwar when iam jumping can someone help me?
My player is just stuck with isInteracting and it is causing me to stay in the falling animation. I have rewatched the last few videos several times.
Managing variables from animations is a bad idea that will bite you sooner or later. At least use triggers that will update variable in a class.
Also, store strings for animation names in one place as public static string and refer only to these static, do not use raw strings in your code!
Does anyone have an issue with the character sliding around after they land
I am having the same issue did you find any solutions?? Please share it with me if you hav
i've made the animator public but it's not working
An excellent tutorial! Just one thing is not going so smoothly which is the transition into the falling animation - it takes a second for it to go from falling to landing. I'm just wondering if anyone else has encountered this problem and knows how to fix it.
Uncheck "Has Exit Time" on the animator transition :^)
Hello! The tutorial is good and I was able to get it to work but there were some issues with unity going between computers and now I’m experiencing some problems.
The jumping is for the most part working fine but I am no longer able to move normally, and isInteracting is constantly on unless its playing the jumping animation. Does anyone know how to fix this? Ive gone through this and the previous video and havent been able to find a way
I was able to fix it! The only issue was that one of the animation transitions didn’t have a condition
@@inklantern1687 how did yo fix?
when does isJumping become false again??
I'm following your tutorials and I love them! Could you do something on gliding?
Could anyone possibly answer why my falling animation is adding a small amount of upward velocity to my player? Anyone ever run into this?
Does your animation have upward root motion by any chance? If so, are you enabling root motion during the falling animation? You can check this using Debug.log :^)
@@SebastianGraves Thank you for taking the time to reply! It seems all of my animation clips say "Root contains root motion curves" Is that what you're referring to? If I reimport the animations and change to None on the root motion, I see the option to adjust the Root Transform Position (Y), but I can't seem to find a combination that makes it look and feel any better.
I'm honestly not sure how I'd go about using Debug.Log to tell if it's being enabled or not. Working on that now though and I will report back.
@@garybuchert7005 Hey Gary!
Root motion essentially moves the character with the animations movements, instead of moving it with code. For jumping and falling in this project we do not want this.
You can use an animation that uses root motion, but disable the root motion via script.
You can check if your animator is using root motion, by referencing the animator variable like this!
Debug.Log(animator.applyRootMotion);
If the console says "True". You are using Root Motion. If it says "False". You are not!
If you are not using root motion, but you are still getting some movement oddities, check for odd collisions between colliders or perhaps a mistake in the code.
Good luck my friend :^)
@@SebastianGraves Hmm strange. The console is telling me "False". I've reimported the jump, fall, and land animations and updated Root Motion Node to on the FBX file before duplicating the animation clips. There is still a very slight upward boost when transitioning from jump to fall, but I'm also now noticing that my jump is moving the player forward without me holding 'W' which tells me that root motion is still enabled somehow?
Think I'm going to call it for the day and come back tomorrow with fresh eyes. Thank you again for taking a look with me!
@@SebastianGraves Yea, has to be in the code or collisions because I removed the animation and the little boost still seems to be there. Thanks again for pointing me in the right direction!
Yayyyyy love these vids
PLEEEAAAASE... Make a tutorial on VAULT and CLIMBING system with your 3rd person controller... I tried to ajust others tutorials on climbing and vaulting with this one and it doesn't work... I'm dying bro... Please do something...
Can you do sliding next please (and if you can)
hey thank you for the series :)
so,
i don't know if i should ask this or not but can you tell how to switch players like in lost ember
like i want to have a main character say ((X )) but want that to possess different other temporary characters = Y,Z,A ,etc.
and when i return i want the main character to reappear.
i am a beginner and have absolutely no idea what is going on with my project
so any help is greatly appreciated .
A comment for the god of comments
thanks a lot
SEE YOU ON THE WINNERS SIDE!! ♥
The player only jumps in place
plz add slope system
Thanks a lot this is my first time doing coding but it all worked out good but I want to tweak it so that i can move while jumping and so that the movement and rotation is not restricted.
thnx for this!!!
This is to please Algorithm Gods.
Het so I followed this seires and I'm having a problem to where my character only jumps when not grounded. Anyone know how to fix that?
Hey i know this tutorial is old but i have done literally everything in this video and i can't jump, my isJumping is ticking but jump_input isn't ticking and my character isn't jumping at all, my characterRigibody.velocity isn't doing anything, does anyone know any fix?