How to Climb in 3D with Godot

  Рет қаралды 8,413

Off-Grid Dev

Off-Grid Dev

3 жыл бұрын

Short video explaining how I implement climbing in my current 3D project. Feel free to ask questions down below, I'm always happy to help!
How to Swim in Godot: • First Person 3D Swimmi...
Music courtesy of Simon Swerwer: / simonswerwer
Tracks:
The King is Dead
Spelunker
Dagger Dance
The Balanced Dunes

Пікірлер: 37
@user-ef3tc2ty8m
@user-ef3tc2ty8m 8 ай бұрын
The start of the video is fantastic, thank you very much!
@MagmaSloth64
@MagmaSloth64 2 жыл бұрын
Oh my goodness this is just what I've needed thank you, I'm so happy to see something posted just a few hours ago that is a subject I've been obessively studying for months now. To be fair I'm studying all different methods that a character can climb a surface and I gotta say this is extremely helpful, thank you! ^^
@off-griddev6597
@off-griddev6597 2 жыл бұрын
Hey no problem! Glad I could help. Hit me up if you have any trouble.
@Boildroid
@Boildroid 2 жыл бұрын
Man, thank you. Your tutorial pure gold.
@off-griddev6597
@off-griddev6597 2 жыл бұрын
No problem mate.
@chrisxdeboy
@chrisxdeboy 2 жыл бұрын
Another option would to run a test move_and_collide() or two to make sure it's possible to climb that before running the climbing part. That's basically how I implemented auto-stepping, move_and_collide() up by the maximum step value, move_and_slide_with_snap() forward with the normal movement velocity, and finally a move_and_collide() down by the max step value.
@off-griddev6597
@off-griddev6597 2 жыл бұрын
Yeah, this is a viable solution. I may update this video at some point, since my climbing is somewhat more advanced with several months of development since this video.
@CarpathianWasteGroup
@CarpathianWasteGroup Жыл бұрын
these visual explanations help A LOT. I just got into game developing just for myself and my gf and these really helping out thanks
@off-griddev6597
@off-griddev6597 Жыл бұрын
That's awesome! Glad I could help!
@DavidM_GA
@DavidM_GA 2 жыл бұрын
I did this with an even simpler system: I put a small raycast where the players hands are. I put a Box collider on 3d assets where ever a "ledge" is. When the player presses "climb" if the ray is hitting a "ledge" collider the climb happens.
@off-griddev6597
@off-griddev6597 2 жыл бұрын
That definitely works, but the thought of having to manually place the box colliders everywhere I want to let the player climb would add a lot of work. Could be alleviated by using prefab scenes with that already set up, but you wouldn't be able to use those everywhere. Though for certain games where the entire environment is procgen prefabs stitched together I could totally see that working. For the game I'm making the possibility of me just missing a spot and having the player jumping uselessly trying to climb a spot that I forgot to add a collider to is something I'd rather avoid. I know some big games have done it similarly to what you're describing though, it's definitely a more controlled approach.
@DavidM_GA
@DavidM_GA 2 жыл бұрын
@@off-griddev6597 Yeah, i try to re-use as many assets as I can as I have no other people creating them :)
@Ceisriel
@Ceisriel Жыл бұрын
My system works better and it also works with stairs no need to add any manual box collision or anything: func _physics_process(delta): #Raycast to detect obstacles in front of the character var ray_length = 2 # Adjust this value based on the desired length of the ray var ray_direction = direction.normalized() # Use the same direction as the character's movement var ray_start = translation + Vector3(0,0.01, 0) # Adjust the starting position of the ray based on your character's position var ray_end = ray_start + ray_direction * ray_length var climb_speed = 1.5 var is_climbing = false var ray_cast = get_world().direct_space_state.intersect_ray(ray_start, ray_end, [self]) if ray_cast: #If the ray hits something, enable vertical movement when pressing the "forward" button if Input.is_action_pressed("forward"): vertical_velocity = Vector3.UP * climb_speed is_climbing = true else: is_climbing = false
@kirillmenshikov8344
@kirillmenshikov8344 Жыл бұрын
Thanks a lot for the tutorial it was really inforamtive. I tried this and it worked well but becouse the upward movement always stays the same it may feel weird in some cases. For example if the player activates climb just when the raycast starts hitting the ledge it will move him to far up in the air and then the player will fall slightly. Maybe you know a solution for dynamically changing the Vector3 value so it won't move the player further than the object it tries to climb?
@AdredenGaming
@AdredenGaming 2 жыл бұрын
Ill have to look at what you have for videos. I like that water shader you have there at the end hopefully I can find a video on that. trying to find a much better water shader atm
@off-griddev6597
@off-griddev6597 2 жыл бұрын
Yeah water can be tricky to get right stylistically, in my game I’ve gone through several iterations beyond the one in this video.
@AdredenGaming
@AdredenGaming 2 жыл бұрын
@@off-griddev6597 I have done 2 iterations at this point but there are a number of things I have to figure out more. like the lensing at the surface and better images for the waves.
@CreatingRiot
@CreatingRiot Жыл бұрын
could be possible to do the same with a moving platform, either horizontally or vertically?
@off-griddev6597
@off-griddev6597 Жыл бұрын
Yes. Though you would have to account for the movement of the platform and make sure the player is tracked to that movement during the climb. Otherwise it’s not going to work for obvious reasons.
@mohamedmoh5789
@mohamedmoh5789 Жыл бұрын
yout tutorials are great thank you ver much , i would love if you could make how to walk up stairs tutorial so the player dont slide
@off-griddev6597
@off-griddev6597 Жыл бұрын
Good to know, I might do that. There are a few tutorials online that explain it but it can be a bit fiddly.
@tiaoraitbg2347
@tiaoraitbg2347 2 жыл бұрын
Thanks for the video! Makes me wonder though, if it might be worth adding 3 more raycasts to the head that are the exact same but just smaller, sort of to gauge if the player could climb if they went into a crouching position, thanks!
@off-griddev6597
@off-griddev6597 2 жыл бұрын
Yeah, I haven’t yet figured out how I want to handle climbing while crouching, since jumping while crouching has always felt a bit weird to me in games. I know in some games trying to do that just makes you stand up, but I’m not totally happy with that either. Something to think about a bit more.
@AdredenGaming
@AdredenGaming 2 жыл бұрын
Maybe its like a burpee, one could be pretty much prone then jump up as high as they can. But really its more how you want your game to feel eh
@TheToradoralove
@TheToradoralove 2 жыл бұрын
Τhanks for this tutorial, it has very clear explanation.However, I i have still a problem with my working game and i would like to ask you. I put the two rays as you mention to grab ledges and for better experience i have done my platform collisions one way (the player collides only as moves up to down). When the condition of the 2 rays is true and i pressed G button, he grabs. But if i press the button when jumps up through a platform and through collision it grabs in the middle of the platform and also he slides across the edge of collision.
@off-griddev6597
@off-griddev6597 2 жыл бұрын
Not sure if I understand your issue correctly, but I think what you’re saying is it doesn’t work right when you’re midway through a platform, as in inside it? If that’s the case, then trying to use this method while inside a collider is probably going to have weird behaviour. I’m not sure exactly how your project works, but maybe you could use an Area node to detect if your player is inside a collider like that, and then decide what you want to happen with climbing based on that?
@TheToradoralove
@TheToradoralove 2 жыл бұрын
@@off-griddev6597 Yes,it doesn’t work right when you’re ascending midway through a platform and you press the grab button because he grabs midway the platform. I want the player to grab only at the corners of platform. I put a third ray if it collides not let player to grab, above his head facing up, and is better but not quite fixed. I will try your suggestion to add an area2d. I am relatively new to godot. I am trying to make a nice realistic 2d platformer with story and dialogues and it is quite difficult for a single person. It would be better if i had some help in case someone finds my project interesting. Thanks very much for your answer.
@RadJordy
@RadJordy Жыл бұрын
I know this is a bit of an older video buuuuut... Could you go over using raycasts to step up onto small ledges? Like a sidewalk or stairs for example? Otherwise, I'd have to put invisible ramps everywhere and that could end up presenting more issues.
@Arisilde
@Arisilde 8 ай бұрын
kzbin.info/www/bejne/f325hpaVrrtlask
@alexlokanin3312
@alexlokanin3312 Жыл бұрын
hey bro this is a really interesting project you're working on, just by the headbob I can tell what it's inspired by. I hope you continue working on it and make your dream come true
@uselessheartinbox1711
@uselessheartinbox1711 Жыл бұрын
alot of games have headbob, real life has headbob, you cant tell what its inspired by
@Ceisriel
@Ceisriel Жыл бұрын
My system works better and it also works with stairs: func _physics_process(delta): #Raycast to detect obstacles in front of the character var ray_length = 2 # Adjust this value based on the desired length of the ray var ray_direction = direction.normalized() # Use the same direction as the character's movement var ray_start = translation + Vector3(0,0.01, 0) # Adjust the starting position of the ray based on your character's position var ray_end = ray_start + ray_direction * ray_length var climb_speed = 1.5 var is_climbing = false var ray_cast = get_world().direct_space_state.intersect_ray(ray_start, ray_end, [self]) if ray_cast: #If the ray hits something, enable vertical movement when pressing the "forward" button if Input.is_action_pressed("forward"): vertical_velocity = Vector3.UP * climb_speed is_climbing = true else: is_climbing = false
@Ceisriel
@Ceisriel 10 ай бұрын
@@pdaw101 the variable translation is the position of ray, where it starts from. Full code on my GitHub if you need it.
@Sp1cyP3pp3r
@Sp1cyP3pp3r Жыл бұрын
WTF IS TWEEEN????
How to climb any wall (in a video game) Godot 3d Tutorial
37:57
Material Based Footsteps in Godot 3D
15:27
Off-Grid Dev
Рет қаралды 8 М.
路飞被小孩吓到了#海贼王#路飞
00:41
路飞与唐舞桐
Рет қаралды 77 МЛН
Happy 4th of July 😂
00:12
Alyssa's Ways
Рет қаралды 64 МЛН
Clown takes blame for missing candy 🍬🤣 #shorts
00:49
Yoeslan
Рет қаралды 36 МЛН
Why Stairs Suck in Games... and why they don't have to
11:24
Nick Maltbie
Рет қаралды 1,5 МЛН
How To Make a 3D Line of Sight System in Godot in 9 Minutes
8:51
Phantasy Dev
Рет қаралды 10 М.
Making Minecraft from scratch in 48 hours (NO GAME ENGINE)
16:38
Scatter -- A Must Have Tool For Godot Level Editors!
10:24
Gamefromscratch
Рет қаралды 45 М.
Godot FPS Movement Tutorial - Wall Running
13:21
Garbaj
Рет қаралды 27 М.
Exporting Characters and Animations From Mixamo To Godot 4!
11:50
FinePointCGI
Рет қаралды 26 М.
MAKE YOUR SCENES LOOK GOOD! | Godot
11:03
NekotoArts
Рет қаралды 23 М.