✅ Get the Project Files unitycodemonkey.com/video.php?v=44qVzrdvm04 🌍 Get my Complete Courses! ✅ unitycodemonkey.com/courses 👍 Learn to make awesome games step-by-step from start to finish. 👇 Click on Show More 🎮 Get my Steam Games unitycodemonkey.com/gamebundle POLYGON - Apocalypse Pack cmonkey.co/synty_apocalypse_ladder 🔴 RELATED VIDEOS 🔴 Kickstart your game with First and Third Person Controllers! (FREE Unity Starter Assets) th-cam.com/video/jXz5b_9z0Bc/w-d-xo.html How to do a BACKSTAB! (Like Elden Ring, Dark Souls) th-cam.com/video/78J493qWfDI/w-d-xo.html
Good tutorial as always! However, I think you skipped over the more difficult problem with ladders - climbing down them from the top. It isnt a problem for short ladders where you can just jump of the ledge but for the taller ladders (like your ladder on the building) it is important. It is difficult to implement as you are approaching the ladder from the wrong side and cant rely on a simple state change to "onLadder", you need to orientate the player first before they can move up and down. I usually do this by lerping the players position and rotation to a known good position when the player approaches the ladder from above. This does take control away from them for a few seconds though.
Although tutorials does not work as soon as it is published, every time I start a new project, I take a look at many of them again. There's enough to make a bunch of games almost from scratch. Keep going!
Fantastic thanks Code Monkey. Another awesome walkthrough of something difficult. Love your way of teaching and the thought processes to solve a problem. Your courses are excellent. We need some Code Monkey apparel!
Since you're starting from Unity's official starting assets this is really useful to me personally. I'd love a video where you just go over how you'd adapt the starter assets to your code style or for certain features, for example, if you don't like how the Cinemachine Input Provider works and want to lock the camera's x movement.
Your videos are always awesome! Short, sweet, to the point, but still very informative. I have just moved from 2D to 3D programming, and I'm sure this will come in very handy very soon 😁
Very very good tutorial. ☺♪♫ Thank you very much ! On my project, with the "new input system" and the "first Person Controller", I had to change this line because the climbing didn't worked in all direction (was working only in one : z+) : inputDirection.y = _input.move.y; // instead of : inputDirection.y = inputDirection.z;
Raycasts really is so useful :D using them a lot on my current side project at Uni for my game. Combining it with Navmeshes and such. I have a lot to learn but it's lots of fun and this tutorial was really useful for ideas :)
as someone going into the house painting profession, I am very grateful for your tutorial. Ladders always seemed so daunting but now I know how to handle them. Thank you so much. love from south Sudan.
Depends on how you handle your character controller, you could place a empty child game object inside the ladder object to define the "center" of the ladder, or just keep the model centered and use the position. Or use the ladder transform.forward to calculate that point For aligning feet perfectly you'd need some kind of IK like Animation Rigging unitycodemonkey.com/video.php?v=LEwYmFT3xDk
Thanks for giving such a good tutorial! From my understanding, this will work great for climbing a ladder from floor. But I am just curious about, do the logic works for climbing down the ladder from roof (top) as well for this tutorial's script?
From the top you would fall a tiny bit then move backwards and it would grab onto the ladder If you wanted to grab it while on top you could add some extra logic to fire a raycast straight down
Hmm not really although the logic would be somewhat similar, each vaultable object would have a collider and be marked as vaultable, then instead of a state machine for vault you just play an animation It-s an interesting topic so I may cover it in more detail in a video, thanks!
Thank you for providing another great tutorial. Could you provide a tutorial on a similar game mechanic -- opening doors? After clicking on a door it always swings away from the player. Thus avoiding striking the player. It would also be nice to include a mechanism for sliding doors -- up and down or left to right.
Depends on how you want to handle the door, using an animation or physics? With animation you would just need to see on which side is the player, similar to testing if behind a character unitycodemonkey.com/video.php?v=78J493qWfDI If you're using Physics and a hinge joint then you can just use Rigidbody.AddTorque or AddFoce
That's really impressive, I mean the way you solve issues and creating the mechanics. I know the experience has it's role, but there must be tips to learn solving the issues and how to make the mechanics that you want. so how can I learn these skills?
Heh sorry but the answer really is just experience, there's no secret hidden trick, it's really just after you've made tons and tons of systems it becomes easier and easier to break a mechanic down into its core components. So keep making lots of games, lots of prototypes on all kinds of genres with all kinds of different mechanics and soon enough you too will be able to think about a brand new mechanic and immediately know how to break it down and implement it.
Thanks for the great content. Constantly impressed with the rate you put these out. RE: Unity Overview Course I took your turn-based course on Udemy (which was great) and every now and then I'll look at the Overview Course when you promote it. I always end up just clicking back however, because the contents are kind of a "wall of text" slap in the face. Feels like the course would be a lot more digestible and accessible if the lectures were grouped into different sections based on the topics they cover. Just a suggestion, maybe Udemy makes this difficult? I'll probably end up getting it eventually anyway once I make my way through my current stack of courses.
Udemy does allow sections but the tools are all very varied, each lecture is standalone covering a different tool, so there really isn't a good way to group them. That course is meant more like a library rather than something you go through once from start to finish. It's something that you can watch once to see lots of tools that Unity has and then refer back to it when you want to use a certain tool.
@@CodeMonkeyUnity Oh, I get that. I'm just saying, I feel like having sections would help facilitate the buffet-style course. Right now I basically have to go through the entire list to find a relevant topic. As in, it would be more digestible if it had sections like Animation, Shaders, Basics, Post-processing, etc. Just a thought. No worries either way.
WARNING TO EVERYONE! If you keep falling off the ladder midclimb (as if you were just jumping and not climbing) it may be caused by animator option: "apply root motion". It fires event on character controller, that applies basic gravity regardless of what you have in script.
Thank you, great video. Is raycasting for a ladder every frame cheaper/more performent than a box collider trigger on the character that only collides with ladders?
In terms of performance both methods are probably going to be the same. A BoxCollider Trigger would possibly be more performance intensive since it's a Box rather than a raycast but not much of a difference So it's mostly personal preference, do you want to do the detection through code or through a separate collider in the editor.
I used it for my game, but the character doesn't climb the stairs. - Character climbs the stairs from its back side, but when I press S key the character rotates 180 degrees and gets down. - When trying to climb the stairs from front side the I need to jump on the stairs so that the character is attached to stairs but the character climbs up with S key and goes down with W key
You are an amazing person and I admire your experience. I would like to make a constructive criticism about your tutorials. They are informative and you have mastery over the subject, however, the small library elements used in previous and future tutorials can be confusing. When trying to replicate what you have done, we need you to show us how it was done. While the small helper code snippets you wrote months ago may make your job easier, we need to start from scratch. As someone who started from scratch just three months ago, this is a criticism made with all good intentions. Thanks for all.
If I did that I would be doing a terrible job as an instructor. In game development you don't begin every single mechanic completely from scratch, if you do you will never finish making a game since you will be reinventing the wheel every time. Games are made up of systems on top of systems, I would advise you to learn about that and get comfortable about linking previously made systems together instead of always trying to build everything from scratch.
Hi! This works great, exept it only works well when the ladder is facing the right direction, if the ladder is rotated for example 180degrees it doesn't work anymore.. I guess it has something to do with the targetDirection, that I should use the ladders axises when moving up or down. I'll try to figure this out but if you have some ideas i would be greatly appreciated. btw i'm using unitys standard fps asset just like you in this video. Some things in it are named a bit different now compared to year ago, maybe the code is a bit different?
I would like to know more about the animation handling ... I suppose IK ... when entering end exiting the ladder because not dealing with that looks weird when character is on exit moving hands like climbing invisible ladder part and entering just by snapping player to ladder looks weird and just playing enter animation no matter the circumstances is unnatural too.
Sure you could combine both, use normal animation in the middle of climbing, and IK while at the top. You just need to play with the Weight for the IK th-cam.com/video/LEwYmFT3xDk/w-d-xo.html
@@CodeMonkeyUnity This was helpful and I will need it for lot of stuff, thanks ... but after some testing Im not sure how to approach snapping hands and feet to ladder rungs and it seems most people covering ladder climbing do not bother or just scale the ladder appropriately but I did wanted something more dynamic. My main issue is probably while I do some IK snap I do no longer know where those hands would be without it so I can adjust it when movement changes ... I did found OnAnimatorIK method so I guess that is right moment when character is not adjusted by IK yet and I will probably try that (tho it will maybe require old scripting approach instead of that rigging package one?) but no matter what I do I feel Im overcomplicating it too much and there should be some simple way Im missing :D
Hi i know this is a random question, i really love how u explain, do you have some tutorials on how to make missions, or going from point a to point b? Because i could not find it on your channel!
That's a bit too specific for a tutorial. You need to break that down into the core components. Maybe you need some collisions? unitycodemonkey.com/video.php?v=Bc9lmHjqLZc Or maybe an arrow pointing towards the target? unitycodemonkey.com/video.php?v=dHzeHh-3bp4 Or maybe interacting with the NPC to get the quest? unitycodemonkey.com/video.php?v=LdoImzaY6M4
Great tutorial, as ever. But once you let go of the ladder at the top, how do you grab onto it to climb down again? I'm thinking about an invisible object with a trigger to turn the player and lower the player onto the ladder (similar to how you push the play up to let go at the top). Is that viable? Are there other and possibly better ways?
The way it is in this video is just like games like Counter Strike or Half Life, you basically jump out then move "back" to grab the ladder, that's the simplest option. The ladder collider does have some thickness so you could just raycast down and test if it is a ladder, if so then keep raycasting until there is no raycast under the player, if so grab the last ladder the raycast saw.
Its not really extendable. You should have an interface field for movement in the player, and change the implementarion based on being on ladder or not.
Do you think putting each action in its own script component, and then enabling/disabling based on state - is a good idea, or rather keep all things in one controller?
Depends on how many actions you have. If you just have Ladder and maybe one other like Crouch I would probably just leave them all in the same file. But if you have 10 character states then yeah making a proper state machine with separate scripts for each state would probably be for the best
@@CodeMonkeyUnity Makes sense. So for example, if a character interacts/mounts into another object - essentially a controller switch. You'd go with disabling/enabling components?
Heh that would be time which I guess you could record a List and store the player position every frame then play it back, kind of like Prince of Persia Sands of Time
The ladder works about as expected but I'm using a third person controller and the character can still rotate, How would I go about locking its rotation towards the ladder?
That will depend on how your controller works. But you know if the character is on a Ladder or not, so just use that bool to lock/unlock the rotation logic.
Sure, that would only affect the animation, all the ladder logic would be the same unitycodemonkey.com/video.php?v=LEwYmFT3xDk unitycodemonkey.com/video.php?v=UL2EbxqwozM
@@CodeMonkeyUnity Thanks for replying. Would you consider doing a tutorial on it? It seems there is no tutorials on it. Is it something that easy that no one even consider it? I would consider adding animation events to enable/disable ik for specific limbs. Would this be a right approach? Thank you.
First, thanks for your works 👏👏, great tutorial, i have an issue, maybe i have an old version of "standart asset", i use this to have a reference my character move value: Vector3 inputDirection = new Vector3(_input.move.x, 0.0f, _input.move.y).normalized; if (_input.move != Vector2.zero) { inputDirection = transform.right * _input.move.x + transform.forward * _input.move.y; } if (!isClimbingLadder) { float avoidFloorDistance = .1f; float ladderGradDistance = .4f; if (Physics.Raycast(transform.position + Vector3.up * avoidFloorDistance, inputDirection, out RaycastHit hitInfo, ladderGradDistance)) { if (hitInfo.transform.TryGetComponent(out Ladder ladder)) { GrabLadder(inputDirection); }; } } I don't have the equivalent of targetDirection, and I didn't manage to create an equivalent... so when I look to the right, my character goes up well, but if I look to the left, the movement is reversed, maybe it's because inputDirection.z return bad value....
This works when going from the ground up. How would you go from the top of the building into a ledge hang or otherwise begin climbing down from above when there's no raycast in front for it? Presumably, you'd have cases where the ladder is peaking out over the edge and where it's not (in which case maybe the collider still extends above?)
With this system I don't think that would be a problem, if the player jumps off a ledge they just have to move backwards as soon as they start falling and it would immediately grab the ladder. Personally I prefer it like this over automatically grabbing the ladder when going down. But if you did want it more automatic, you could just check when the player loses IsGrounded and do a bunch of raycasts (forward, back, sideways) and if a ladder is found grab it.
its not working for me \(T.T)/ i have a 3rd person character :C can someone help me please T.T i disable rigidbody and nothing happens public class PlayerController : MonoBehaviour { public CharacterController pcontroller; [SerializeField] private float playerSpeed = 5f; [SerializeField] private float rotationSpeed = 10f; [SerializeField] private Camera followCamera; private Vector3 _playerVelocity; private bool _groundedPlayer; [SerializeField] private float jumpHeight = 2.0f; [SerializeField] private float gravityValue = -9.81f; Rigidbody rb;
public MovementState state; public enum MovementState { freeze, unlimited, } public bool freeze; public bool unlimited; public bool restricted; public Vector3 moveDir = Vector3.zero; private void Start() { pcontroller = GetComponent(); } private void Update()
@@CodeMonkeyUnity I don't remember at this point. Somebody posted the script in the comments, so maybe there was something wrong with that. I could try again, but I don't think I want to write it all out.
In URP they are called Decal Projectors docs.unity3d.com/Packages/com.unity.render-pipelines.universal@12.0/manual/renderer-feature-decal.html I think they do exactly what the legacy Projector did, but not 100% sure since I never used those
It doesn`t work for the third person. I have to delete "_verticalVelocity = 4f;" everywhere. If I don`t, I slide up automatically once I pressed "w". Without this it works to get up, but I always fall down. I can`t find a way to climb down again. And the console says that "DropLadder();" gets called when I`m on the ladder. I don`t know what to do.
Yeah if you were to add many more interactions like this to that character controller I would definitely refactor it at some point to use a different structure. But just like this, handling movement and ladders, I think it's still pretty manageable.
I haven't played it myself, how do they handle ladders? Do they just not have ladders at all? From what I know about the game it does have a lot of buildings so perhaps the design team decided regular stairs were enough
I'm getting increasingly concerned with the amount of tutorials that keep popping up tell me how to do something I want to do but haven't even typed it in the search bar before it shows up in my home feed
@@arcday4281 I still don’t get your point. Because people aren’t making as many 2D tutorials, he shouldn’t have done this one? So the tutorial isn’t for you… don’t be so entitled
@@bakerfx4968 Don't write nonsense, this tutorial is quite suitable for 2d, the logic is the same. I repeat once again, this kind of tutorial was not enough when various 2d controller systems were considered!!! (I have watched absolutely every video of this channel and legitimately make such an honest conclusion) This is not whining in the comments. Didn't you notice the smile "))) " (don't be stupid)
✅ Get the Project Files unitycodemonkey.com/video.php?v=44qVzrdvm04
🌍 Get my Complete Courses! ✅ unitycodemonkey.com/courses
👍 Learn to make awesome games step-by-step from start to finish.
👇 Click on Show More
🎮 Get my Steam Games unitycodemonkey.com/gamebundle
POLYGON - Apocalypse Pack cmonkey.co/synty_apocalypse_ladder
🔴 RELATED VIDEOS 🔴
Kickstart your game with First and Third Person Controllers! (FREE Unity Starter Assets) th-cam.com/video/jXz5b_9z0Bc/w-d-xo.html
How to do a BACKSTAB! (Like Elden Ring, Dark Souls) th-cam.com/video/78J493qWfDI/w-d-xo.html
Project files link says invalid video id
you have to change it manual to ...=44qVzrdvm04
I discovered your channel a few months back and it's genuinely one of my favorite channels because you help me with almost anything I need
Thanks! I'm glad the videos have helped you!
I am following you for years now, and just want to thank you. You are the reason I’m a full time game developer in a company
Good tutorial as always! However, I think you skipped over the more difficult problem with ladders - climbing down them from the top. It isnt a problem for short ladders where you can just jump of the ledge but for the taller ladders (like your ladder on the building) it is important.
It is difficult to implement as you are approaching the ladder from the wrong side and cant rely on a simple state change to "onLadder", you need to orientate the player first before they can move up and down. I usually do this by lerping the players position and rotation to a known good position when the player approaches the ladder from above. This does take control away from them for a few seconds though.
Great tutorial! Ladders always seamed daunting to program. Now when I eventually want ladders in a game I make, I know a great tutorial to watch.
Although tutorials does not work as soon as it is published, every time I start a new project, I take a look at many of them again. There's enough to make a bunch of games almost from scratch. Keep going!
Fantastic thanks Code Monkey. Another awesome walkthrough of something difficult. Love your way of teaching and the thought processes to solve a problem. Your courses are excellent. We need some Code Monkey apparel!
Thanks for the kind words!
Since you're starting from Unity's official starting assets this is really useful to me personally. I'd love a video where you just go over how you'd adapt the starter assets to your code style or for certain features, for example, if you don't like how the Cinemachine Input Provider works and want to lock the camera's x movement.
oh man, i tried like three times to make a ladder system in a 2.5D game, all of them were buggy af, this comes handy, thanks cm
Your videos are always awesome! Short, sweet, to the point, but still very informative. I have just moved from 2D to 3D programming, and I'm sure this will come in very handy very soon 😁
Very very good tutorial. ☺♪♫ Thank you very much !
On my project, with the "new input system" and the "first Person Controller", I had to change this line because the climbing didn't worked in all direction (was working only in one : z+) :
inputDirection.y = _input.move.y; // instead of : inputDirection.y = inputDirection.z;
Another useful Tutorial.
I will surely use this one soon for a more robust 3D 3rd Person Character Controller.
Thank you!
Brilliant! Thanks!
Raycasts really is so useful :D using them a lot on my current side project at Uni for my game. Combining it with Navmeshes and such. I have a lot to learn but it's lots of fun and this tutorial was really useful for ideas :)
as someone going into the house painting profession, I am very grateful for your tutorial. Ladders always seemed so daunting but now I know how to handle them. Thank you so much. love from south Sudan.
I didn't know how to climb ladders until now.
Thank you CodeMonkey.
wouldnt it break if you start climbing the ladder by walking backwards/sideways?!
I have additional questions. How to match character position to the ladder boundaries and how to align feet with rangs.
Depends on how you handle your character controller, you could place a empty child game object inside the ladder object to define the "center" of the ladder, or just keep the model centered and use the position.
Or use the ladder transform.forward to calculate that point
For aligning feet perfectly you'd need some kind of IK like Animation Rigging unitycodemonkey.com/video.php?v=LEwYmFT3xDk
Thanks for giving such a good tutorial! From my understanding, this will work great for climbing a ladder from floor. But I am just curious about, do the logic works for climbing down the ladder from roof (top) as well for this tutorial's script?
From the top you would fall a tiny bit then move backwards and it would grab onto the ladder
If you wanted to grab it while on top you could add some extra logic to fire a raycast straight down
This is awesome thanks! Do you think you could do a tutorial on basic vaulting?
Hmm not really although the logic would be somewhat similar, each vaultable object would have a collider and be marked as vaultable, then instead of a state machine for vault you just play an animation
It-s an interesting topic so I may cover it in more detail in a video, thanks!
Thank you for providing another great tutorial. Could you provide a tutorial on a similar game mechanic -- opening doors? After clicking on a door it always swings away from the player. Thus avoiding striking the player. It would also be nice to include a mechanism for sliding doors -- up and down or left to right.
Depends on how you want to handle the door, using an animation or physics? With animation you would just need to see on which side is the player, similar to testing if behind a character unitycodemonkey.com/video.php?v=78J493qWfDI
If you're using Physics and a hinge joint then you can just use Rigidbody.AddTorque or AddFoce
That's really impressive, I mean the way you solve issues and creating the mechanics. I know the experience has it's role, but there must be tips to learn solving the issues and how to make the mechanics that you want. so how can I learn these skills?
Heh sorry but the answer really is just experience, there's no secret hidden trick, it's really just after you've made tons and tons of systems it becomes easier and easier to break a mechanic down into its core components.
So keep making lots of games, lots of prototypes on all kinds of genres with all kinds of different mechanics and soon enough you too will be able to think about a brand new mechanic and immediately know how to break it down and implement it.
@@CodeMonkeyUnity Thank you
Very nice 👍
What a thrill
Thanks for the great content. Constantly impressed with the rate you put these out.
RE: Unity Overview Course
I took your turn-based course on Udemy (which was great) and every now and then I'll look at the Overview Course when you promote it. I always end up just clicking back however, because the contents are kind of a "wall of text" slap in the face. Feels like the course would be a lot more digestible and accessible if the lectures were grouped into different sections based on the topics they cover. Just a suggestion, maybe Udemy makes this difficult? I'll probably end up getting it eventually anyway once I make my way through my current stack of courses.
Udemy does allow sections but the tools are all very varied, each lecture is standalone covering a different tool, so there really isn't a good way to group them.
That course is meant more like a library rather than something you go through once from start to finish. It's something that you can watch once to see lots of tools that Unity has and then refer back to it when you want to use a certain tool.
@@CodeMonkeyUnity Oh, I get that. I'm just saying, I feel like having sections would help facilitate the buffet-style course. Right now I basically have to go through the entire list to find a relevant topic.
As in, it would be more digestible if it had sections like Animation, Shaders, Basics, Post-processing, etc.
Just a thought. No worries either way.
WARNING TO EVERYONE! If you keep falling off the ladder midclimb (as if you were just jumping and not climbing) it may be caused by animator option: "apply root motion". It fires event on character controller, that applies basic gravity regardless of what you have in script.
Oh yeah don't use root motion with this system otherwise it will indeed conflict with the ladder logic
Thank you, great video. Is raycasting for a ladder every frame cheaper/more performent than a box collider trigger on the character that only collides with ladders?
In terms of performance both methods are probably going to be the same. A BoxCollider Trigger would possibly be more performance intensive since it's a Box rather than a raycast but not much of a difference
So it's mostly personal preference, do you want to do the detection through code or through a separate collider in the editor.
I used it for my game, but the character doesn't climb the stairs.
- Character climbs the stairs from its back side, but when I press S key the character rotates 180 degrees and gets down.
- When trying to climb the stairs from front side the I need to jump on the stairs so that the character is attached to stairs but the character climbs up with S key and goes down with W key
You are an amazing person and I admire your experience. I would like to make a constructive criticism about your tutorials. They are informative and you have mastery over the subject, however, the small library elements used in previous and future tutorials can be confusing. When trying to replicate what you have done, we need you to show us how it was done. While the small helper code snippets you wrote months ago may make your job easier, we need to start from scratch. As someone who started from scratch just three months ago, this is a criticism made with all good intentions. Thanks for all.
If I did that I would be doing a terrible job as an instructor. In game development you don't begin every single mechanic completely from scratch, if you do you will never finish making a game since you will be reinventing the wheel every time.
Games are made up of systems on top of systems, I would advise you to learn about that and get comfortable about linking previously made systems together instead of always trying to build everything from scratch.
Just curious, why do we check for the vector being in the up direction instead of forward if the ladder is in front of us?
I think ur a magician, u read my mind, really!
Hi! This works great, exept it only works well when the ladder is facing the right direction, if the ladder is rotated for example 180degrees it doesn't work anymore.. I guess it has something to do with the targetDirection, that I should use the ladders axises when moving up or down. I'll try to figure this out but if you have some ideas i would be greatly appreciated. btw i'm using unitys standard fps asset just like you in this video. Some things in it are named a bit different now compared to year ago, maybe the code is a bit different?
This is amazing! I am just starting with my first FPS prototype and this is exactly what I needed :D
Nice! Best of luck with that project!
If you use animation than disable "Apply Root Motion" otherwise it wont work (at least for me it didnt)
Took me 2 weeks to figure this out :(
can you make a video how to implement a Push/Pull System? Like in Zelad Ocarina of time
That would be a fun video idea! Thanks for the tip!
Every code monkey must be able to climb ladders!
I would like to know more about the animation handling ... I suppose IK ... when entering end exiting the ladder because not dealing with that looks weird when character is on exit moving hands like climbing invisible ladder part and entering just by snapping player to ladder looks weird and just playing enter animation no matter the circumstances is unnatural too.
Sure you could combine both, use normal animation in the middle of climbing, and IK while at the top. You just need to play with the Weight for the IK th-cam.com/video/LEwYmFT3xDk/w-d-xo.html
@@CodeMonkeyUnity This was helpful and I will need it for lot of stuff, thanks ... but after some testing Im not sure how to approach snapping hands and feet to ladder rungs and it seems most people covering ladder climbing do not bother or just scale the ladder appropriately but I did wanted something more dynamic. My main issue is probably while I do some IK snap I do no longer know where those hands would be without it so I can adjust it when movement changes ... I did found OnAnimatorIK method so I guess that is right moment when character is not adjusted by IK yet and I will probably try that (tho it will maybe require old scripting approach instead of that rigging package one?) but no matter what I do I feel Im overcomplicating it too much and there should be some simple way Im missing :D
I set unity orientation mode to "auto rotation" but it doesn't work when my android device has lock orientation enabled. Can you please help me?
Hi i know this is a random question, i really love how u explain, do you have some tutorials on how to make missions, or going from point a to point b? Because i could not find it on your channel!
That's a bit too specific for a tutorial. You need to break that down into the core components. Maybe you need some collisions? unitycodemonkey.com/video.php?v=Bc9lmHjqLZc
Or maybe an arrow pointing towards the target? unitycodemonkey.com/video.php?v=dHzeHh-3bp4
Or maybe interacting with the NPC to get the quest? unitycodemonkey.com/video.php?v=LdoImzaY6M4
@@CodeMonkeyUnity i found a video where u made a taxi game, but there are no tutorials
Great tutorial, as ever. But once you let go of the ladder at the top, how do you grab onto it to climb down again? I'm thinking about an invisible object with a trigger to turn the player and lower the player onto the ladder (similar to how you push the play up to let go at the top). Is that viable? Are there other and possibly better ways?
The way it is in this video is just like games like Counter Strike or Half Life, you basically jump out then move "back" to grab the ladder, that's the simplest option.
The ladder collider does have some thickness so you could just raycast down and test if it is a ladder, if so then keep raycasting until there is no raycast under the player, if so grab the last ladder the raycast saw.
Yay, I love it. Please do the tutorial about jumping over objects, like parkour stuff
Parkour is definitely a topic I'd love to cover!
Its not really extendable. You should have an interface field for movement in the player, and change the implementarion based on being on ladder or not.
good
Do you think putting each action in its own script component, and then enabling/disabling based on state - is a good idea, or rather keep all things in one controller?
Depends on how many actions you have. If you just have Ladder and maybe one other like Crouch I would probably just leave them all in the same file.
But if you have 10 character states then yeah making a proper state machine with separate scripts for each state would probably be for the best
@@CodeMonkeyUnity Makes sense. So for example, if a character interacts/mounts into another object - essentially a controller switch. You'd go with disabling/enabling components?
What about the fourth dimension?
Heh that would be time which I guess you could record a List and store the player position every frame then play it back, kind of like Prince of Persia Sands of Time
The ladder works about as expected but I'm using a third person controller and the character can still rotate, How would I go about locking its rotation towards the ladder?
That will depend on how your controller works. But you know if the character is on a Ladder or not, so just use that bool to lock/unlock the rotation logic.
I have a question can I use character customize stream live on TikTok or just TH-cam ?
Do you mean an overlay like I have in my livestreams? I don't know if TikTok has an API to get the chat but it probably does so yes
@@CodeMonkeyUnity yes 👍 thank you so much. best man in Universe
How can we make a navmesh agent to climb or descend ladders?
You would need to manually set up navigation links and handle the logic for playing the animation and moving it from one place to another
thank you
Is it possible to add ik to feet and hands?
Sure, that would only affect the animation, all the ladder logic would be the same
unitycodemonkey.com/video.php?v=LEwYmFT3xDk
unitycodemonkey.com/video.php?v=UL2EbxqwozM
@@CodeMonkeyUnity Thanks for replying. Would you consider doing a tutorial on it? It seems there is no tutorials on it. Is it something that easy that no one even consider it?
I would consider adding animation events to enable/disable ik for specific limbs. Would this be a right approach?
Thank you.
What to do if I want AI to climb?
What about animation that matches ladder steps/handles I mean hands position while climbing?
Animation rigging package is what you need, u can see how he made pick up anim in one of his video for reference
Yup look into the Animation rigging package unitycodemonkey.com/video.php?v=LEwYmFT3xDk
unitycodemonkey.com/video.php?v=UL2EbxqwozM
First, thanks for your works 👏👏, great tutorial,
i have an issue, maybe i have an old version of "standart asset",
i use this to have a reference my character move value:
Vector3 inputDirection = new Vector3(_input.move.x, 0.0f, _input.move.y).normalized;
if (_input.move != Vector2.zero)
{
inputDirection = transform.right * _input.move.x + transform.forward * _input.move.y;
}
if (!isClimbingLadder)
{
float avoidFloorDistance = .1f;
float ladderGradDistance = .4f;
if (Physics.Raycast(transform.position + Vector3.up * avoidFloorDistance, inputDirection, out RaycastHit hitInfo, ladderGradDistance))
{
if (hitInfo.transform.TryGetComponent(out Ladder ladder))
{
GrabLadder(inputDirection);
};
}
}
I don't have the equivalent of targetDirection, and I didn't manage to create an equivalent...
so when I look to the right, my character goes up well, but if I look to the left, the movement is reversed, maybe it's because inputDirection.z return bad value....
Thanks for the video. I’ve been trying to hack this out for a while now.
Invalid video id
This works when going from the ground up. How would you go from the top of the building into a ledge hang or otherwise begin climbing down from above when there's no raycast in front for it? Presumably, you'd have cases where the ladder is peaking out over the edge and where it's not (in which case maybe the collider still extends above?)
With this system I don't think that would be a problem, if the player jumps off a ledge they just have to move backwards as soon as they start falling and it would immediately grab the ladder. Personally I prefer it like this over automatically grabbing the ladder when going down.
But if you did want it more automatic, you could just check when the player loses IsGrounded and do a bunch of raycasts (forward, back, sideways) and if a ladder is found grab it.
Invalid video id in the project link
Oh seems I had the wrong Id, here it is unitycodemonkey.com/video.php?v=44qVzrdvm04
Thanks for letting me know!
its not working for me \(T.T)/
i have a 3rd person character :C
can someone help me please T.T
i disable rigidbody and nothing happens
public class PlayerController : MonoBehaviour
{
public CharacterController pcontroller;
[SerializeField]
private float playerSpeed = 5f;
[SerializeField]
private float rotationSpeed = 10f;
[SerializeField]
private Camera followCamera;
private Vector3 _playerVelocity;
private bool _groundedPlayer;
[SerializeField]
private float jumpHeight = 2.0f;
[SerializeField]
private float gravityValue = -9.81f;
Rigidbody rb;
public MovementState state;
public enum MovementState
{
freeze,
unlimited,
}
public bool freeze;
public bool unlimited;
public bool restricted;
public Vector3 moveDir = Vector3.zero;
private void Start()
{
pcontroller = GetComponent();
}
private void Update()
{
Movement();
moveDir = transform.TransformDirection(new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical")));
}
private void StateHandler()
{
// Mode - Freeze
if(freeze)
{
state = MovementState.freeze;
rb.velocity = Vector3.zero;
}
//Mode - Unlimited
else if (unlimited)
{
state = MovementState.unlimited;
playerSpeed = 999f;
}
}
void Movement()
{
if (restricted) return;
_groundedPlayer = pcontroller.isGrounded;
if (_groundedPlayer && _playerVelocity.y < 0)
{
_playerVelocity.y = 0f;
}
float horizontal = Input.GetAxis("Horizontal");
float vertical = Input.GetAxis("Vertical");
Vector3 movementInput = Quaternion.Euler(0, followCamera.transform.eulerAngles.y, 0) * new Vector3(horizontal, 0, vertical);
Vector3 movementDirection = movementInput.normalized;
float avoidFloorDistance = .1f;
float ladderGrabDistance = .4f;
if (Physics.Raycast(transform.position + Vector3.up * avoidFloorDistance, movementInput, out RaycastHit raycastHit, ladderGrabDistance))
{
if (raycastHit.transform.TryGetComponent(out Ladder ladder))
{
this.GetComponent().useGravity = false;
movementInput.y = movementInput.z;
movementInput.z = 0f;
_groundedPlayer = true;
}
}
pcontroller.Move(movementDirection * playerSpeed * Time.deltaTime);
if (movementDirection != Vector3.zero)
{
Quaternion desiredRotation = Quaternion.LookRotation(movementDirection, Vector3.up);
transform.rotation = Quaternion.Slerp(transform.rotation, desiredRotation, rotationSpeed * Time.deltaTime);
}
// Changes the height position of the player..
if (Input.GetButtonDown("Jump") && _groundedPlayer)
{
_playerVelocity.y += Mathf.Sqrt(jumpHeight * -3.0f * gravityValue);
}
_playerVelocity.y += gravityValue * Time.deltaTime;
pcontroller.Move(_playerVelocity * Time.deltaTime);
}
}
"not working" isn't very descriptive. Does the Raycast find the object? Does it move at all? Does it move up and imediately fall down?
👍
I can't even test the project with this in the files.
Why not? What error do you get?
@@CodeMonkeyUnity I don't remember at this point. Somebody posted the script in the comments, so maybe there was something wrong with that. I could try again, but I don't think I want to write it all out.
lol identifying by script feels like such a cheat. Hmm... maybe there's a better way with a centralized hashmap of objects and their categories~?
send this to bethesda
In the title it was clarified that it's a Unity Tutorial, but I actually wouldn't mind a real life how-to ladder climbing refresher.
Heh I would love it if my gym had a Salmon Ladder!
Do you know if is something similar to projector in urp, because projectors are not compatible anymore with urp?
In URP they are called Decal Projectors docs.unity3d.com/Packages/com.unity.render-pipelines.universal@12.0/manual/renderer-feature-decal.html
I think they do exactly what the legacy Projector did, but not 100% sure since I never used those
First ❤
It doesn`t work for the third person. I have to delete "_verticalVelocity = 4f;" everywhere. If I don`t, I slide up automatically once I pressed "w". Without this it works to get up, but I always fall down. I can`t find a way to climb down again. And the console says that "DropLadder();" gets called when I`m on the ladder. I don`t know what to do.
Worried that in this way character contoller might become a giant kitchen sink class...
Yeah if you were to add many more interactions like this to that character controller I would definitely refactor it at some point to use a different structure. But just like this, handling movement and ladders, I think it's still pretty manageable.
And here i still wonder why tarkov doesnt have this
I haven't played it myself, how do they handle ladders? Do they just not have ladders at all? From what I know about the game it does have a lot of buildings so perhaps the design team decided regular stairs were enough
I'm getting increasingly concerned with the amount of tutorials that keep popping up tell me how to do something I want to do but haven't even typed it in the search bar before it shows up in my home feed
MY EYESSS! bro please dont use light mode in your ide its cursed
Sorry, dark mode burns my eyes
To be honest, with "ladders" you are objectively two years late ... (this was not enough on the channel) but better late than never)))
What
@@bakerfx4968 I mean, maybe someone needed a "2d ladders system" when tutorials with 2D controllers were released...a couple of years ago...
@@arcday4281 I still don’t get your point. Because people aren’t making as many 2D tutorials, he shouldn’t have done this one?
So the tutorial isn’t for you… don’t be so entitled
@@bakerfx4968 Don't write nonsense, this tutorial is quite suitable for 2d, the logic is the same. I repeat once again, this kind of tutorial was not enough when various 2d controller systems were considered!!! (I have watched absolutely every video of this channel and legitimately make such an honest conclusion) This is not whining in the comments. Didn't you notice the smile "))) " (don't be stupid)
@@arcday4281 Unnecessarily passive aggressive. It's a helpful video that will always be relevant.