Godot Recipe: KinematicBody + Stopping on Slopes

Поділитися
Вставка
  • Опубліковано 14 жов 2024
  • Is your character sliding down slopes? Learn how to make your KinematicBody stick!
    Text version: godotrecipes.co...
    Support me on Patreon: / kidscancode

КОМЕНТАРІ • 56

  • @garbaj
    @garbaj 3 роки тому +26

    thanks for the video! I see a lot of tutorials using velocity = move_and_slide(velocity) instead of just move_and_slide(velocity) by itself which seems to work just fine. I'm sure there's a reason but I can't seem the grasp the concept behind it. What exactly is going on there?

    • @Kidscancode
      @Kidscancode  3 роки тому +6

      `move_and_slide()` returns a modified velocity vector that slides along the colliding surface. This is well-documented: docs.godotengine.org/en/stable/tutorials/physics/using_kinematic_body_2d.html
      docs.godotengine.org/en/stable/classes/class_kinematicbody2d.html#class-kinematicbody2d-method-move-and-slide

    • @garbaj
      @garbaj 3 роки тому +5

      @@Kidscancode thanks!

    • @klutchres
      @klutchres 2 роки тому

      Too
      Garbaj
      I didn't expect you to be here 😄

  • @oneilc818
    @oneilc818 2 роки тому +21

    Is this channel still active? There's so many good videos here, Chris. I hope you keep making more.

    • @cocoonprince
      @cocoonprince 2 роки тому +11

      late reply, but they're active in the godot discord, where they said they'll probably start making new content when the beta for 4.0 comes out.

    • @multiarray2320
      @multiarray2320 2 роки тому +2

      @@cocoonprince that would be awesome!

    • @not_importan
      @not_importan 2 роки тому

      @@cocoonprince Guess what, Godot 4 Beta is out >:D

    • @cocoonprince
      @cocoonprince 2 роки тому +1

      @@not_importan @Abandonware Games not sure about new videos, but they are in the process of updating their website with 4.0 tutorials.

    • @not_importan
      @not_importan 2 роки тому

      @@cocoonprince a bit sad, i prefer the video format, but will make sure to check out their website from time to time. Ty for the update.

  • @Bananeisafree
    @Bananeisafree 3 роки тому +5

    Welp ... Here is a life saving video !
    Thank you for your work !

  • @NicholasOrlowski
    @NicholasOrlowski 3 роки тому +6

    Awesome breakdown, thanks!

  • @griddolini2118
    @griddolini2118 2 роки тому +2

    I remember trying to do this in the past on my own and it caused a weird issue clinging to edges when you try to walk off a cliff. Decided to try this again since I'm cleaning up my first person controller, instead of using my homebrew slope detection algorithm. This gives me the same result in much less code. Appreciated!

  • @Jayhonas
    @Jayhonas 2 роки тому

    Everyone should know about this channel! Your work is amazing.

  • @necaton
    @necaton 3 роки тому +4

    thank you for the video!

  • @psychicide3851
    @psychicide3851 3 роки тому +1

    come on babe, new kidscancode video is out

  • @Ericksamma01499
    @Ericksamma01499 2 роки тому +1

    Bro, this is so good, how you put particles for the walking start, and for jump, when it jumps, and then land, I don't find any video about it

  • @thomasamathew4058
    @thomasamathew4058 2 роки тому +1

    Why have you stopped posting ?
    This is a great channel.

  • @ahmadtakhimi6839
    @ahmadtakhimi6839 3 роки тому +1

    Thank you soo much for the tutorials...

  • @unanimous4367
    @unanimous4367 3 роки тому +1

    Noticed on the thumbnail that the textures would get blurry at a certain distance, you can fix this by enabling the anisotropic filter in the import tab.

  • @pistachoduck9128
    @pistachoduck9128 3 роки тому +2

    Let's goooo, this is what i was looking for!

  • @Exerionius-old
    @Exerionius-old 3 роки тому +3

    But how do you stop on steeper slopes instead of sliding?
    Let's say I don't want to make the slope angle bigger, I want the character to stop on a steeper slope so it's not possible to climb slopes above 45 degrees.

  • @collane8751
    @collane8751 2 роки тому +1

    In godot2d, how to generate thousands of units and keep the framerate smooth? I want to keep the units spaced from each other, use collision detection, but it drops frames before 300 unit。so,pleases make a tutorial to teach us! It is said that using the navigation function can be effectively solved, but I don't know how to do it! thanks

  • @giantfrogstudios839
    @giantfrogstudios839 2 роки тому +2

    Why did the videos suddenly stop?

  • @MarkIsAsleep
    @MarkIsAsleep 3 роки тому +2

    Please make tutorial on how to make fog of war on rts games, where area are hide when out of vision

  • @raghavsood28
    @raghavsood28 2 роки тому

    Hi, i love your python videos! Do you plan on teaching other languages such as java too?

  • @pravinvjreigns6055
    @pravinvjreigns6055 2 роки тому

    Thanks for the video

  • @phamhoa5590
    @phamhoa5590 3 роки тому

    your channel is great,

  • @platinumdiamond7
    @platinumdiamond7 3 роки тому +1

    If possible could you make a video on how to make Tween Camera transitions in Godot akin to that of Mega Man/Metroid/Zelda?

  • @noiamhippyman
    @noiamhippyman 2 роки тому +1

    This just flat out doesn't work anymore. My character slides regardless of this and everybody keeps pointing to just using "stop on slopes" and it never works.

  • @npc_blob1609
    @npc_blob1609 Рік тому

    How would I update the max floor angle to match the player's current rotation? if I want them to be able to walk up any surface, they get slowed down and stuck as the angle increases, even with a max floor angle of 360. At least I'm assuming this feature of move_and_slide_with_snap is what's causing it

  • @Switch620
    @Switch620 2 роки тому

    My hero!!!

  • @ariiqwicaksana5944
    @ariiqwicaksana5944 Рік тому

    pls can you make 8 way shooting with lock system like cuphead? When i searched i only found tutorials about shooting with mouse and I don't want that

  • @iit_Madras_.
    @iit_Madras_. Рік тому

    My 2d game is little bit stuttering in rendering after exporting it to as a debug apk in android in godot 4.0.3 what should I do its even 21 Mb in length

  • @Speed-TV
    @Speed-TV Рік тому

    Where do you set jumping to true. It's never shown!

  • @99JasonKim
    @99JasonKim 3 роки тому +1

    Finally

  • @Xeadriel
    @Xeadriel 2 роки тому +1

    doesnt solve the issue for me. it doesnt consider it as a wall. I checked with is_on_wall() too. it considers it as a floor but still slides down the slope even with stop on slope turn to true. any ideas?

    • @ZarkianStuffnThings
      @ZarkianStuffnThings 2 роки тому

      Below the "solving" piece of code he put in, you can put:
      if is_on_floor() and velocity.x < 2: #for when you are going right
      velocity.y = 0
      elif is_on_floor() and velocity.x > -2: #for when you are going left
      velocity.y = 0
      It works but only uphill. (tweak the velocity.x values to fit your game)
      You can also do this for the Z axis too.
      Unfortunately at the time of writing this I don't know anything that would make it work for when you go downhill.

    • @Xeadriel
      @Xeadriel 2 роки тому

      @@ZarkianStuffnThings well thanks. I'll try when the issue comes up again.

  • @shindig9000
    @shindig9000 Рік тому

    If you know, I would like to understand why a VehicleBody3D doesn't have the move and slide function and how you can do some of this stuff with that.

    • @Kidscancode
      @Kidscancode  Рік тому +1

      Vehicle body inherits from RigidBody, not Kinematic. It is controlled by the physics engine.

    • @shindig9000
      @shindig9000 Рік тому

      @@Kidscancode I do understand the part about inheritance which is why I know it doesn't have the move and slide, but it seems like I don't understand what it really means to be controlled by the physics engine and what kind of limitations that imposes 😅
      Any advice on how to learn more about this and what it can can't do?
      I wanted to make a car controller that is more arkady like the twisted metal games, but after now seeing your video about the arcade car controller, I'm wondering if that would be a better route.
      If you think it is, is it possible to use a capsule shape instead of a ball in order to move on, or does it have to be a ball so it can actually roll when you're adding force to it?
      Thank you for your response 🙏

    • @Kidscancode
      @Kidscancode  Рік тому +1

      @@shindig9000 Yes, the sphere technique is a sphere so that it will roll when a force is applied to it. Rigid bodies move when forces are applied to them, just like real physical objects. If you want it to move, it needs to be "pushed" by something.
      This is a great series showing how the vehicle body works: ua-cam.com/video/B5vE-nNszxA/v-deo.html

    • @shindig9000
      @shindig9000 Рік тому

      @@Kidscancode Thank you. This has helped a lot.
      I think one of the last questions I have is what is the best approach to getting a VehicleBody3D to flip right-side-up if upside down?
      So far I've just tried to change the rotate of the vehicle body but that isn't enough to overcome the physics it seems.
      This is why I almost wonder if doing your arcade car would be a better approach to make controls like twisted metal, but I think that's going to take a lot of experimentation as well to have other cars interact by their vehicle mesh instead of the ball, but I don't even know if there is a way to transfer collisions from that mesh to change the momentum of the ball and also how you animate the mesh appropriately with that 🤔
      Sorry about the long message, but again thank you. This got me a lot further to where I wanted to be.

  • @waiver269
    @waiver269 2 роки тому

    Hey guys, please help ! Me and my friend want to share our project beetween us to edit in godot, as both wants to manage the project. What can we do ???

    • @ars1618
      @ars1618 Рік тому

      kinda late but you can use git to share the project and control it's versions

  • @skaruts
    @skaruts 3 роки тому

    Is there no jumpiness when you're going down the slope?

  • @phamhoa5590
    @phamhoa5590 3 роки тому +1

    I have a feeling that because of your channel's name, so your video is not popular, in spite of good video

  • @charlesselrachski34
    @charlesselrachski34 Рік тому

    godot 4.1 let's go

  • @dizzydude2840
    @dizzydude2840 3 роки тому

    oh my god its mr bradfield

  • @sm_stormzy1075
    @sm_stormzy1075 2 роки тому

    Hi :D

  • @klutchres
    @klutchres 2 роки тому

    Y'all Better teach Unity because that engine is very powerful and broad and c# can make you understand Many other languages,
    Unreal engine is way too advanced for new Developers and Godot is way too Simple for Developers to Get intrigued with

    • @Kidscancode
      @Kidscancode  2 роки тому +1

      There are lots of Unity tutorials available. If you want Unity, I would suggest you watch one of them.

    • @klutchres
      @klutchres 2 роки тому

      @@Kidscancode yeah that's true