Stop Character Sliding Down Slopes in Godot - Godot Quick Tips

  Рет қаралды 9,672

Code with Tom

Code with Tom

2 жыл бұрын

Have you ever noticed that your character slides down slopes when using the move_and_slide function in Godot? In this video I show you a quick and easy solution to stop your character sliding down slopes in Godot 3.4.
Shout out to 3Dude whose video helped me with this common problem. You can find his original video here: • Godot Tutorial - Slope...
---
Patreon: / codewithtom
Discord: / discord
Twitter: / codewithtom
Github: github.com/codewithtom

Пікірлер: 48
@ikim76
@ikim76 2 жыл бұрын
This is great, this is the best solution for this problem. For anyone interested, the reason this works is this: when we multiply the velocity by the floor normal vector, this effectively adds a velocity.x amount that counters the velocity.x value that the engine adds automatically to simulate objects being pulled down by gravity and thus making them slide in the direction of the slope. While your character is on the slope, gravity changes direction to the floor normal, and to the engine it is as if it is not a slope at all.
@bloodlust_unlimited
@bloodlust_unlimited 2 жыл бұрын
Good to see you again! Thx for content!
@spikedpancakes
@spikedpancakes 2 жыл бұрын
Hey thanks to you, i wrote my first script, i followed one of your other vids, I hope to take up game design in tge near future!
@evarobison
@evarobison 2 жыл бұрын
Thank you so much! I was just struggling with this issue a few days ago.
@CodeWithTom
@CodeWithTom 2 жыл бұрын
Really hope this helps you resolve the issue :)
@dueddel
@dueddel 2 жыл бұрын
Great to see you being back again, by the way. 😘
@tanushbissessur2032
@tanushbissessur2032 2 жыл бұрын
you are the biggest help i will ever have.
@bruhnah4life
@bruhnah4life 11 ай бұрын
Thank you very much for this tutorial, at first it was buggy because i didnt put my code and the new code with the exact order, thanks
@CodeWithTom
@CodeWithTom 11 ай бұрын
Glad it helped!
@pravinvjreigns6055
@pravinvjreigns6055 Жыл бұрын
Thank for your video,it is really useful
@davidmurphy563
@davidmurphy563 2 жыл бұрын
Hope everything is fine. Will you be continuing with the channel? Imho, it was the best technical tutorial content for Godot.
@kochkarov
@kochkarov 2 жыл бұрын
Thank you for a great video! Are you planning to expand this by adding movement on stairs?
@CodeWithTom
@CodeWithTom 2 жыл бұрын
Thanks, I'm glad you liked the video. Actual stairs are a bit trickier but can also be "faked" by simply making the collision area of the staircase a simple slope.
@Speed-TV
@Speed-TV Жыл бұрын
I tried this with 2D, and it didn't work :( The only thing I did differently was replace Vector3.UP with Vector2.UP
@pinu8348
@pinu8348 10 ай бұрын
Mine didn’t either and this video was the earliest thing that shows up on the front page when searching for this problem. Incase anyone still using 3.5 reads this, I fixed my problem by putting the “safe margin”(kinematicbody2d > collision) above the default value
@fingorchipz8662
@fingorchipz8662 2 жыл бұрын
He's back 😊😊
@joemop8790
@joemop8790 Жыл бұрын
great stuff 😄
@McKack
@McKack 2 жыл бұрын
Weird, I seem to recall reading or hearing somewhere that 3.4 was supposed to fix this. Maybe it was only for 2D :\ Either way, this solution is clean and simple! Looks like the best one so far! Any issues with snapping to ground so you don't fly off the end of upward slopes or bump down slopes?
@CodeWithTom
@CodeWithTom 2 жыл бұрын
It's been a particular bug bear of mine for quite a while and I've been hoping it would be fixed for a while. I haven't experienced any issues with leaving the ground at the top of slopes but I'll do some further testing and post an update if this is the case. I believe the move_and_slide snapping options could be used to ensure this doesn't happen if that's the case.
@McKack
@McKack 2 жыл бұрын
@@CodeWithTom Awesome! I'll be testing it out on my test project as well soon, replace a bunch of messy lines of code with this instead and see how it fairs :)
@ClawMacKain
@ClawMacKain 2 жыл бұрын
Sadly as someone making a 2D game using Godot using ver 3.4.4 the sliding slope issue is still a thing. And because of that I'm currently trying to find a code to negate it for my game. Sadly the code Tom provided doesn't work for a 2D build it seems.
@dafellachallam7384
@dafellachallam7384 2 жыл бұрын
Hey Tom, In your 2nd episode of "how to make a fps game" I have a problem it says *attempt to call function 'is_colliding' in base 'null instance's on a null instance
@coder-serwin3545
@coder-serwin3545 2 жыл бұрын
Amazing bro! Love ur Content..
@CodeWithTom
@CodeWithTom 2 жыл бұрын
Thank you, glad you enjoyed it!
@coder-serwin3545
@coder-serwin3545 2 жыл бұрын
@@CodeWithTom :)
@kryperdev
@kryperdev 2 жыл бұрын
Brilliant!
@kulak8548
@kulak8548 Жыл бұрын
Any plans to continue the channel? Would love to see some more AI content like the FPS in Godot part 4.
@pucksclips6383
@pucksclips6383 Жыл бұрын
So I’m learning your tutorial on how to make an fps game in Godot from 2019 and my character only moves right and if I want to move forward or backward I have to be moving right at the same time and left just doesn’t do anything. Any fix?
@artisanpixel
@artisanpixel Жыл бұрын
Any update for how to get this working in 4.0 ? They screwed up the new CharacterBody3d, and now it is all buggy and can't get sliding on slopes working like this anymore! Hope you can figure it out.
@1luckyjo
@1luckyjo 2 жыл бұрын
Brilliant Tom xxx
@CodeWithTom
@CodeWithTom 2 жыл бұрын
Thank you :)
@friendlyreptilian3767
@friendlyreptilian3767 2 жыл бұрын
thx!
@alexxxiy69
@alexxxiy69 4 ай бұрын
if not is_on_floor(): velocity.y -= gravity * delta
@Tox_sickle22
@Tox_sickle22 2 жыл бұрын
Id like to see a video about git Godot integration it is really confusing id really like you to make a video about it
@houseofosborne1173
@houseofosborne1173 Жыл бұрын
Also rip, great teaching channel
@DejaimeNeto
@DejaimeNeto 2 жыл бұрын
yes
@problemletstalknoletschat2288
@problemletstalknoletschat2288 2 жыл бұрын
Btw. do your "old" Godot FPS Controllers still work in v3.4.4 ?
@kulak8548
@kulak8548 Жыл бұрын
They do, and I was able to get them working in 4.0 as well with a few minor changes.
@problemletstalknoletschat2288
@problemletstalknoletschat2288 Жыл бұрын
@@kulak8548 Thanks a lot fellow dev!
@shardaojha7558
@shardaojha7558 Жыл бұрын
Hello sir, were are you now these days. Is your health ok?? You can always ask for help to me thank you
@MikeMcRoberts
@MikeMcRoberts Жыл бұрын
Why did Tom's videos suddenly stop 8 months ago? is Tom OK?
@kulak8548
@kulak8548 Жыл бұрын
He has recent posts on Twitter, so he's still kicking. Hopefully he'll make a comeback.
@velsia123
@velsia123 Жыл бұрын
tried your solition and it made my character slide faster....
@houseofosborne1173
@houseofosborne1173 Жыл бұрын
Based
@thezadek
@thezadek 2 жыл бұрын
honestly, this was there for so long that it's making me lose faith in the engine. i am noticing similar pattern with the new 2D features in Godot 4.0 where they have been broken since implementation and no one dropped single comment on those and the maintainer's outright refusal to add proper masking features. why should i waste my time with an engine that lacks something so basic?
@__Rizzler__
@__Rizzler__ 2 жыл бұрын
Yea thanks mate
@CodeWithTom
@CodeWithTom 2 жыл бұрын
You're very welcome :)
@__Rizzler__
@__Rizzler__ 2 жыл бұрын
@@CodeWithTom you too sir.
3D Pathfinding in Godot using Navigation Mesh
7:42
Code with Tom
Рет қаралды 11 М.
I Made the Same Game in 8 Engines
12:34
Emeral
Рет қаралды 3,9 МЛН
孩子多的烦恼?#火影忍者 #家庭 #佐助
00:31
火影忍者一家
Рет қаралды 52 МЛН
Best father #shorts by Secret Vlog
00:18
Secret Vlog
Рет қаралды 22 МЛН
100❤️
00:19
MY💝No War🤝
Рет қаралды 23 МЛН
I Melted Wood With Friction
8:44
The Action Lab
Рет қаралды 716 М.
Why Stairs Suck in Games... and why they don't have to
11:24
Nick Maltbie
Рет қаралды 1,5 МЛН
Import 3D Models From Blender into Godot - Godot Quick Tips
7:55
Code with Tom
Рет қаралды 77 М.
We made Vampire Survivors BUT in 10 Lines of Code
7:08
PlayWithFurcifer
Рет қаралды 1 МЛН
Starter state machines in Godot 4
10:58
The Shaggy Dev
Рет қаралды 42 М.
Optimizing my Game so it Runs on a Potato
19:02
Blargis
Рет қаралды 490 М.
Weapon Camera & Aim Down Sights - Make an FPS in Godot Part 5
23:49
Code with Tom
Рет қаралды 25 М.
13 ADDONS to SPEED UP your game creation in GODOT!
11:23
MrEliptik
Рет қаралды 104 М.
How to Create a INVENTORY in Godot 4 (step by step)
25:31
DevWorm
Рет қаралды 54 М.
孩子多的烦恼?#火影忍者 #家庭 #佐助
00:31
火影忍者一家
Рет қаралды 52 МЛН