Godot 4 Sourcelike FPS Character Controller Tutorial | Smooth Movement, Bhop, Surf, And More

Поделиться
HTML-код
  • Опубликовано: 23 дек 2024

Комментарии • 115

  • @MajikayoGames
    @MajikayoGames  7 месяцев назад +11

    Hi everyone! Thanks for watching. If you enjoyed this video, make sure to check out the full FPS tutorial playlist where we will add many other features to the FPS controller we built in this video.
    Full Playlist: ruclips.net/p/PLbuK0gG93AsHID1DDD1nt4YHcdOmJvWW1

    • @guitargatekeeper
      @guitargatekeeper 2 месяца назад

      How did you get the asset "Godot-Engine-FPS", Droivox" working in godot 4??

    • @Among-wl1ir
      @Among-wl1ir Месяц назад

      Hello! How you make smooth camera after stop player move?

  • @joshkgw9504
    @joshkgw9504 4 месяца назад +24

    This is easily the best first person character controller tutorial for godot on RUclips, seriously! You have no idea how helpful this was, cheers.

  • @servingcurnt
    @servingcurnt 6 месяцев назад +17

    omg u have no idea how incredibly helpful this was!! i’ve been struggling to find good tutorials like this where there’s actually explanations instead of someone just adding random code without explaining it at all. especially since there’s not that many people that make 3d tutorials of godot in the first place. but anyways, this was amazing and i can’t wait to watch more of your videos :D keep up the good work !!

  • @timeitEX
    @timeitEX 28 дней назад +3

    Dear friend, I find this video to be both instructive and fascinating.

  • @fantasia_y2756
    @fantasia_y2756 6 дней назад +1

    This is hands down the best Godot tutorial one could find!

  • @Potato6153
    @Potato6153 7 месяцев назад +11

    You are quickly becoming one of the best tutorial creators, as You are going very in depth and it's great not only for beginners

  • @Jetiix
    @Jetiix 7 месяцев назад +5

    Amazing work, your solutions are much more elegant than mine, with the same principles! You are a real pro at this!
    I tried to make the crouch jump by moving one collision box into another, and the stair stepping with an area cast, but they were both really buggy, your tutorials have been helping me a lot, I hope your channel grows a lot.

    • @MajikayoGames
      @MajikayoGames  7 месяцев назад +1

      Appreciate your comment! Glad you enjoyed :) I'm gonna be making a lot more videos so hopefully people will continue to find my tutorials and code useful.

  • @fluttershy3642
    @fluttershy3642 7 месяцев назад +12

    Are you serios, I've spent so long trying to code source style movment and failing. You're a god's send!

    • @MajikayoGames
      @MajikayoGames  7 месяцев назад +2

      Glad I could help :D let me know if you have any questions about it. I'm also going to be doing some more videos soon to get sourcelike stair handling, ladders, water, and some more stuff.

    • @fluttershy3642
      @fluttershy3642 7 месяцев назад +1

      @@MajikayoGames Really intresting, will you try and get the ladder speed bost thing aswell? When you look up sideways on the ladder while holding (A or D) + W it dobbles the speed. You know what I am talking about? And isen't stair handeling usually just an invisible hitbox that is sloped for smooth ups and downs?

    • @MajikayoGames
      @MajikayoGames  7 месяцев назад

      @@fluttershy3642 I think I've seen videos of the ladder boosting, but I'm not 100% sure what it is. If you want, I can send you the current build of what I'm working with and planning on doing the next few videos on. Then you could tell me if it is correct behavior or not. My discord is @majikayogames

    • @blossomcherrypink
      @blossomcherrypink 7 месяцев назад

      ​@@fluttershy3642 Bro you just reminded me so hard of CS 1.6 surf maps

  • @Reznovelty
    @Reznovelty 5 месяцев назад +3

    You probably have the best tutorial style for fps games right now. I love how you get to the point while also explaining everything really well. Also well done for using proper variable standards and using built in functions, another tutorial i was watching was jumping all over the place haha

  • @Marandal
    @Marandal 7 месяцев назад +4

    Awsome. i love me some Source movement. Thank you Maj

  • @veldtwalker
    @veldtwalker 3 месяца назад +1

    Thank you so much for making the starter project folder as well!

  • @prod.zer000
    @prod.zer000 Месяц назад +1

    You have the video I’ve been searching for I love you

  • @robinj6997
    @robinj6997 2 месяца назад +1

    That was very nice laid out and explained. I take your word for surfing and bhop because I can't do it

  • @Kolbiathan
    @Kolbiathan 7 месяцев назад +2

    You are a LEGEND! Thank you so much for your clear and in-depth explanations of these topics.

  • @Qyedo
    @Qyedo 2 месяца назад +1

    BRO IT'S A FOOCKING BANGER! THANK YOU SO MUCH

  • @PastaMaster115
    @PastaMaster115 6 месяцев назад +3

    I did something a little extra. I made it so sprinting isn't used unless there is forward velocity. If you're moving backwards or directly sideways, sprint doesn't work. Only forward. 👍

  • @wifelessyt
    @wifelessyt 5 месяцев назад +2

    This video is a hidden gem

  • @gilbertocaldeira5935
    @gilbertocaldeira5935 3 месяца назад +1

    you absolutely saved me on some of your tutorials

  • @uncertawn
    @uncertawn 23 дня назад

    This is insanely good thank you so much!

  • @sinecure5
    @sinecure5 7 месяцев назад +2

    Excellent stuff, you're a great teacher.

  • @tuxhome3686
    @tuxhome3686 7 месяцев назад +1

    Was looking to learn 3d in Godot, will be following this tutorial!

  • @renolc-games
    @renolc-games 2 месяца назад +1

    For controllers, it might work better to not normalize the inputs. That'll let you walk or look slower by not tilting the stick all the way.
    That's probably why it was difficult for you to aim precisely, because your code interprets any slight tilt in any direction no differently than full throttle.

  • @supersonic_kai_99
    @supersonic_kai_99 4 месяца назад +1

    thanks loved learning this!

  • @mirage3dee
    @mirage3dee 7 месяцев назад +1

    Wonderful content. Thank you for your time and effort.

  • @vsupps1
    @vsupps1 25 дней назад

    Wow. Just wow. Thank you so much.
    I will repay the community one day.
    I want to say I love you, but I wont hahaha

  • @kirasmith1147
    @kirasmith1147 12 дней назад

    btw, to make the sensitivity scale like cs2 or similar, multiply by deg_to_rad(0.022)
    also, use event.screen_relative instead of event.relative

  • @tedmosby1235
    @tedmosby1235 7 месяцев назад +1

    Ooooh nice bro ! helping a lot !

  • @TRUFANATIC
    @TRUFANATIC 7 месяцев назад +1

    THIS IS INSANE

  • @erracode
    @erracode 2 месяца назад +1

    i would like more tutorials about the surf part :) ama beginner but i want to make a surf game some day

  • @RamS-xz6ku
    @RamS-xz6ku 7 месяцев назад +3

    Amazing vid rly helpful, do you think there would be a way to combine surfing and titanfall style wallrunning code ?

    • @MajikayoGames
      @MajikayoGames  7 месяцев назад

      Yeah this sounds like a pretty fun idea for a high skill cap movement fps game. I had a similar idea before. It's pretty easy to check when in surf mode. Probably just checking if clip velocity was called on a wall of some angle. Maybe some walls you can only surf, and others are too steep so you can wallrun, if that's what you mean.

    • @RamS-xz6ku
      @RamS-xz6ku 7 месяцев назад +2

      @@MajikayoGames yeah exactly provided you have enough momentum to wallrun but also are there any similarities between wallrunning and surfing logic

    • @MajikayoGames
      @MajikayoGames  7 месяцев назад +1

      @@RamS-xz6ku I haven't implemented wallrunning before, but I guess it would depend on how you implement it. Off the top of my head, with how I have this controller currently set up, maybe you would add a _handle_wallrun function like the others, which would run in the case of maybe having a sufficient amount of some wallrun which gets depleted, and exits right away if not is_on_wall() and the wall is not a correct angle. You could do wall_normal.angle_to(Vector3.UP) and wallrun if it's between like deg_to_rad 85 and 95 degrees or so. I would think wallrun code would be a bit different as you want the play to stick to wall more cleanly and not just slide based on gravity vs strafe as we do here. Could be a fun tutorial, I'll add it to my ideas list.

    • @RamS-xz6ku
      @RamS-xz6ku 7 месяцев назад +1

      ​@@MajikayoGamesthx for explaining how i could go about it I'll try it out, looking forward to ur vids tho

    • @RamS-xz6ku
      @RamS-xz6ku 7 месяцев назад +2

      Umm also I noticed that if ur jumping forward in air and click the s key all your forward momentum just stops would there be a way for momentum to change more naturally?
      Edit nvm I'm dumb changing that makes it feel more natural yes but i can't do those fast look around boost things anymore so... Smh

  • @rulerof4breads
    @rulerof4breads 2 месяца назад

    14:06 I get a wierd error message saying " Invalid operands 'Nil' and 'float' in operator '*' " and I have no idea why it's happening. I don't know what I did wrong so if anyone knows please help.

  • @raminkuntopolku8636
    @raminkuntopolku8636 7 месяцев назад +3

    How would one implement ramp sliding like in source games? Like when you hit a slant/ramp straight on at a high speed, you just keep sliding. Currently in this project the player character just slows down aggressively. Also it seems like bunnyhopping without airstrafes seems to slow you down because the friction is applied from the first frame you touch the ground. How could i make bunnyhopping conserve the speed i have?

    • @MajikayoGames
      @MajikayoGames  7 месяцев назад

      Not sure what you mean about bunnyhopping without airstrafes slowing you down. I'm not sure exactly how source does it, do they actually wait a frame before applying any friction? I though they just applied a small amount of friction each frame you're on the ground, so if you gain speed faster than the friction by air strafing, you can speed up. You can adjust the character's ground friction to change how this behaves.
      The issue of sliding on slopes, I'll make a note of that, I already have a similar issue here on github that I want to look into. Looks like a few mechanics depend on slope angle:
      github.com/majikayogames/SimpleFPSController/issues/1

    • @raminkuntopolku8636
      @raminkuntopolku8636 7 месяцев назад

      @@MajikayoGames I mean just hopping straight (simply holding space with autobunnyhop) should let you conserve all of your speed and not slow down a little bit each time you touch the ground. I don't know how source does it but that's what cs bunnyhop and surf servers feel like.
      I don't want to lower the friction since that would make the regular ground movement slippery right? and that wouldn't eliminate the issue completely either.

    • @MajikayoGames
      @MajikayoGames  7 месяцев назад +2

      @@raminkuntopolku8636 i think they just have less friction than this controller does by default. try lowering the ground_friction and ground_decel values a bit. yes it is more slippery but source games are more slippery than this controller by default too. also in source there is a different crouch friction which i didnt add yet.

    • @lethn2929
      @lethn2929 6 месяцев назад

      @@raminkuntopolku8636 I'm late to the the video but in case your looking for a bit more detail or anyone is wondering the character controller itself has settings on angles which dictate whether or not it can even slide on them and I found it was interfering with my attempts at implementing vent crawling awhile back, following settings will likely affect things a bit.
      . Wall min slide
      . Max Angle
      . Stop on slope boolean
      Hope this helps people

  • @traumwelt1975
    @traumwelt1975 7 месяцев назад +1

    might be too advanced for me but thanks a lot for the share of knowledge.

  • @saveborg1091
    @saveborg1091 7 месяцев назад +2

    i have a question... does the "hide child" by switching layer mask would let me setup a multiplayer game? i have this issue where I CANT find a way to hide myself and not the other player.
    Edit: fucking god this video it's insanely well done! the snippet codes explaination... for example what .basis it's litterally the best thing you could've done. PLEASE continue like this.

    • @MajikayoGames
      @MajikayoGames  7 месяцев назад +1

      Yes later in the tutorial series (which may take some time to get the videos out) we will use the layer mask feature to help us create a multiplayer game. What you would do here, is only call the code to hide each player's model, on their own machine in _ready(). You can use is_multiplayer_authority() for that, if each client is given authority over their own CharacterBody3D which is probably the approach I'll go with. Then, only the local player model will be hidden and the rest will be shown. You can also just set the nodes to invisible in _ready() depending on which client the code is executing on. Super glad the basis explanation was well received! Goal was to make it accessible to new learners.

  • @gibbdev
    @gibbdev 22 дня назад

    Hey, wonderful vid :3 Helped a lot. I have one question tho. Does your controller allow character at high "air_cap" to sorta climb walls while moving head on into wall? Wouldnt it make more sence to scale "air_cap" with character speed so stop players from slowly creeping up the walls during surf?

  • @dawidch
    @dawidch Месяц назад +1

    hi! i've got a little problem. i cannot turn while in the air. pls help ;(

  • @Niksona-p1x
    @Niksona-p1x 6 дней назад

    for some reason when i use "left" and "right" inputs character moves left/right and forward at the same time "up" "down" inputs dont work too

  • @man_moth
    @man_moth 3 месяца назад

    Hello, i am having a strange issue, when i click play and try to look around i can only look up and down and not left/right but i think i have copied all the code correctly

  • @Iyad-i3j
    @Iyad-i3j 4 месяца назад +1

    Is there any way for me to directly copy and paste all the code because it’s taking me way to long to write it down

    • @MajikayoGames
      @MajikayoGames  4 месяца назад

      the github link in the description has the completed project

    • @Iyad-i3j
      @Iyad-i3j 4 месяца назад

      @@MajikayoGames thx and your amazing at what u do btw

  • @SoulofStorm333
    @SoulofStorm333 5 месяцев назад

    hello ! great tutorial, but i feel like a simple jump after walking make you jump really far away, how would you tweak the specific amount you can jump when pressing forward while jumping ? i feel like it shouldn't be the same initial velocity as walking, maybe normalized since you are going up and front. so where would that be added ?

  • @gronko_chug_butter
    @gronko_chug_butter 7 месяцев назад +2

    Is there any reason to use the self keyword, or is it just for readability.

    • @MajikayoGames
      @MajikayoGames  7 месяцев назад +1

      nope it is implicit for all variables/funcitons in scope of current node but I like to put it there to make it more clear for myself personally

  • @jotao2345
    @jotao2345 5 месяцев назад

    excellent video and explaining, will you in the future make a video showing how to create a gun with animations?

  • @Imirui
    @Imirui 4 месяца назад +1

    How would I go about removing b-hopping if I didn't want my game to have it?

    • @MajikayoGames
      @MajikayoGames  4 месяца назад

      I think it's kind of hard to remove completely and keep source style movement. You can try things like increasing friction, and decreasing the air_accel and other air movement variables to help prevent movement exploits like bhop. For a more simple version, I'd recommend LegionGames FPS tutorial and take the air movement code from there which is much simpler and should help prevent bhop.

  • @Lily-kv3rb
    @Lily-kv3rb 6 месяцев назад +1

    I'm running into some issues with the "Advanced ground movement with friction/bhop" section. I copied exactly what was in the video but unless I decrease the ground_friction var from 6.0 to atleast 5.0 or lower my character doesn't move when I press forward. I even downloaded the starter project file from github and copy pasted the _handle_ground_movement func from their (except for the headbob piece, I didn't want to add headbob) and I'm still frozen when the friction value is set at 6.0. This wouldnt be a problem if setting the friction value lower also made my base speed extremely fast. Any ideas on fixing this issue?

    • @MajikayoGames
      @MajikayoGames  6 месяцев назад

      It's hard to say without seeing your code, those accel/decel/friction vars are pretty sensitive though. I would try with my values first, copying exactly from my code. Then adjust one by one. Yes if friction or decel is higher than accel or walk speed, probably you won't be able to move. I don't have a clear explanation for each, other than it's just the quake/source movement recipe. Not super intuitive but it gets the exact same movement style so it's important that these variables are used how they are. So I would try copying exactly from my code and changing one by one adjusted until you get your desired move speed/feel. Also check if the properties are changed in the editor inspector on your character, if you change them once, they will stay the same even if you change them in code I think. If you can't figure it out, you can pastebin your code and message it to me on twitter and I could take a look if you want.

  • @leoman7787
    @leoman7787 3 месяца назад

    how do i turn while jumping with just mouse movement? i dont want to hold strafe keys while doing this

  • @PastaMaster115
    @PastaMaster115 7 месяцев назад +2

    Is there a benefit to nesting your if statements instead of just using "and"? Especially if there isn't expected to be an elif or else.

    • @MajikayoGames
      @MajikayoGames  7 месяцев назад +1

      Nope no difference. Sometimes I do it in my own code if I feel it makes it more clear and easier for me to read, or if I'm planning to add some more code there later.

  • @JosephAlejandroAguilarFlores
    @JosephAlejandroAguilarFlores 5 месяцев назад

    Hello, very good tutorial but I have a doubt, when I stick to a straight wall the speed increases, how can I prevent that?

  • @empMerp
    @empMerp 4 месяца назад

    Great tutorial, The only problem I have is when ever I land after surfing or run into a wall while bhoping my character gets stuck in MOTION_MODE_FALLING.

    • @empMerp
      @empMerp 4 месяца назад

      nvm just a very small typo

  • @WeirdGrunkovic
    @WeirdGrunkovic 4 месяца назад

    I've been having an issue where godot does not recognise the the function get_move_speed() , despite it being used in the advanced movement + friction section of the video, do you know why this could be happening and do you have any advice that could help? Thanks

    • @WeirdGrunkovic
      @WeirdGrunkovic 4 месяца назад

      Also thanks a lot for this tutorial! its very informative and its helped me understand how movement and physics work in this engine, despite the one hiccup ive had (which is probs my fault lol) everything ive interpreted from the video has worked flawlessly

  • @redpz
    @redpz 3 месяца назад

    I'm a little confused as to how the air_cap, air_accel and air_move_speed variables are affecting the air strafing. Right now it feels like I can accelerate way too fast and turn way too far without a speed penalty.

  • @MjkL1337
    @MjkL1337 2 месяца назад

    awesome tutorial, i loved the feeling and will use it in my game, but come on man, saying 12 gravity felt more realistic is kinda weird considering that it's literally meters/second/second (if you are using correctly as to multiplying by the delta like you did), and earth's gravity constant is 9.81, which is exactly the value godot comes with lol

    • @man_moth
      @man_moth 2 месяца назад +1

      Its not weird. Most games have higher gravity than earth. For example dying light 2 had more realistic gravity but people complained it was too slow. If you exaggerate the jump height for gameplay reasons you will fall surprisingly slow with normal gravity, so you exaggerate that as well to make it feel good.

  • @Dailyfiver
    @Dailyfiver 22 дня назад

    For some reason my camera looks snappy and smooth when I’m moving it quickly, but when I move it slowly it looks jittery.

  • @nvvv_
    @nvvv_ 4 месяца назад

    39:45 I know you have updated tutorials but it seems like this is still your solution. Since I don't need full on surfing in my project, I'm gonna omit this. Definitely find a new solution if you can though, I can easily imagine a bug that gets you stuck in floating mode.
    Look up the Red Letter Day skip in Half-Life 2 if you want to understand why this can be a SMALL issue.
    Fast Edit: It's not explicitly Red Letter Day I guess. Watch a Half-Life 2 speed run, it's very early on. You're looking for them to jump off a roof onto a street that should definitely kill the player, and then they'll rub up against a car for a little bit. Then something MAGICAL happens.

  • @mersonkrazyTV
    @mersonkrazyTV 3 месяца назад

    I'm hoping you'll be able to help with this question, but when you press S while jumping forward, your player character comes to an immediate stop, and it feels really weird, how would you go about adding a type of air friction to the player controller to smooth out that interaction?

    • @man_moth
      @man_moth 2 месяца назад

      I would also like this and also more air movement control (not air strafing just have wasd help accelerate you in air)

  • @RustyChroma
    @RustyChroma 10 дней назад

    regarding the movement: i can only go diagonally when pressing any keys and can only move with air strafing

    • @RustyChroma
      @RustyChroma 10 дней назад

      i've figured out the problem: i forgot to replace the wish_dir.x line to wish_dir.z

  • @Go_Coup
    @Go_Coup 4 месяца назад

    If I wanted to make strafing and back-stepping at two different speeds than the forward movement, what would be your method to change the code? I did it my own way, but I don't believe it's anywhere near the ideal method (I changed the accel, decel, and speed values based on the inputs in the get_move_speed function. I also have a walk variable, making the code lengthy with 12 elif statements.) On the bright side, the way I did it allows for a highly refined movement system (I thought changing the friction would be redundant, but I'm thinking about changing the jump height.)

  • @Imirui
    @Imirui 4 месяца назад

    since this is an FPS tutorial series, will there ever be a weapon system, or will it just be movement related?

  • @ModdedProp
    @ModdedProp 2 месяца назад

    Do a tutorial on how to make a mirror please

  • @gnateb6048
    @gnateb6048 2 месяца назад

    the air movement is really jank for me idk what im doing wrong

  • @JuJuR
    @JuJuR 4 месяца назад

    I’m guessing it would work the same for 3rd person?

  • @banfps7270
    @banfps7270 Месяц назад

    i keep having a delta error

  • @RubberMayhaps
    @RubberMayhaps 2 месяца назад

    Seems to be setting the Camera3D to the bottom of the player for me
    Edit: Nevermind solved it. Camera3D has its Y value at 1.79 instead of the head so the head was at the bottom of the player

  • @ImnotAbelsuni34
    @ImnotAbelsuni34 Месяц назад

    I made this in C# and it works well, but when I'm surfing or falling my framerate slowly drops from 165 to 40. I tried using Jolt, but it didn't help Can someone help?
    I have a Ryzen 5 7600x and an RX 6750XT, so it's not a hardware problem.
    EDIT: I fixed it! Make sure to add a speed cap to falling, otherwise you will accelerate infinitely, and the calculations will cause your framerate to drop significantly
    I changed the falling in AirPhysics:
    velocity.Y = Mathf.Max(velocity.Y + GetGravity().Y * (float)delta, MAX_FALL_SPEED);
    (Make a MAX_FALL_SPEED float, i set it to -50f)

  • @jamesoneill4607
    @jamesoneill4607 7 месяцев назад +1

    What about those stairs though? 😁

    • @MajikayoGames
      @MajikayoGames  7 месяцев назад +3

      Tutorial for those should be out in a few days as part of this series :) have 1 short vid to make before that

  • @nataliereilly7895
    @nataliereilly7895 7 месяцев назад +1

    👍🏽👍🏽👍🏽

  • @vsupps1
    @vsupps1 26 дней назад

    ive rewatched and redid the first five minutes 4 times and I can still see my glasses covering my face. Can anyone please help me? so stressed out haha

  • @WeirdWimp
    @WeirdWimp 2 месяца назад

    FPS is first person shooter FPP is first person perspective

  • @vmGrymm
    @vmGrymm 5 месяцев назад

    Are you god?

  • @leoman7787
    @leoman7787 3 месяца назад +1

    bump

  • @AlberFrazGames
    @AlberFrazGames 20 дней назад

    i suck at fortnite :(

  • @skerra
    @skerra 3 месяца назад

    I want to limit the players bhop speed but keep the speed in air uncapped so surfing etc isn't effected. The player should still be able to exceed the max speed cap in air through strafing but be set back to the threshold after touching the ground.
    Tried to implement it myself but it felt unsmooth as the change in speed was really noticeable.
    Dont want the player to go to fast.

  • @christophereberhart7487
    @christophereberhart7487 3 месяца назад +3

    So this video is already deprecated due to the experimental nature of Godot, rotate_x is no longer a supported method.
    It is now rotate(), E.G. $Camera3D.rotate(Vector3(1, 0, 0), -event.relative.y * look_sensitivity)
    would have been nice, if they slowly phased out old methods, instead of dropping them next update lmao

    • @MajikayoGames
      @MajikayoGames  3 месяца назад +1

      From what I can tell both are available still? At least in 4.3: docs.godotengine.org/en/stable/classes/class_node3d.html#class-node3d-method-rotate-x

    • @christophereberhart7487
      @christophereberhart7487 3 месяца назад

      @@MajikayoGames it throws an error as a null reference

    • @christophereberhart7487
      @christophereberhart7487 3 месяца назад

      @@MajikayoGames you know what, I think it's a mistake on my part, because it's not referencing the camera object for some reason.
      embarrassing.

    • @christophereberhart7487
      @christophereberhart7487 3 месяца назад

      Yeah, it was an error on my part, I deeply apologize for any misinformation I may have spread.

    • @MajikayoGames
      @MajikayoGames  3 месяца назад

      @@christophereberhart7487 no worries everyone makes mistakes.

  • @lethn2929
    @lethn2929 6 месяцев назад +1

    Since people were understandably asking about ladders I thought I'd post something up that I hacked together.
    if isTouchingLadder == false:
    self.velocity.x = wishDirection.x * getMoveSpeed()
    self.velocity.z = wishDirection.z * getMoveSpeed()
    elif isTouchingLadder == true:
    self.velocity.x = 0
    self.velocity.z = 0

    var inputDirection = Input.get_vector("Right", "Left", "Backward", "Forward").normalized()
    wishDirection = self.global_transform.basis * Vector3(-inputDirection.x, 0, -inputDirection.y)

    if isTouchingLadder == true && Input.is_action_pressed("Forward"):
    self.velocity.y = 1
    if isTouchingLadder == true && Input.is_action_pressed("Backward"):
    self.velocity.y = -1
    if isTouchingLadder == true && Input.is_action_just_released("Forward") || Input.is_action_just_released("Backward"):
    self.velocity.y = 0
    elif isTouchingLadder == true && Input.is_action_just_pressed("Jump"):
    isTouchingLadder == false
    Seems to work alright, I prefer having more control on ladders when it comes to my movement so on this one you can go up and down I think there's a bit of a bug where the jump key doesn't seem to quite work right away but that's potentially just my character clipping through the ladder and not colliding correctly because when I crouch and jump instead it comes off the ladder which I kind of like anyway lol.
    The IsTouchingLadder is simply a boolean, I had it change based on whether or not I triggered an Area3D in this case on the ladder and then that allowed the ladder movement to happen, if you want to do it with a keypress just edit the code to your liking, everyone's got their preferences.

    • @MajikayoGames
      @MajikayoGames  6 месяцев назад +1

      Looks great! I have a more comprehensive video on ladders as well if anyone is interested: ruclips.net/video/uW01u_1PldI/видео.html

  • @YourZoneX
    @YourZoneX 4 месяца назад

    wish_dir = self.global_tranform.basis * Vector3(-input_dir.x, 0., -input_dir.y)