Godot 4 3D Platformer Lesson #13: Align Player with Ground!

Поділитися
Вставка
  • Опубліковано 28 жов 2024

КОМЕНТАРІ • 70

  • @geeceekuusi
    @geeceekuusi 2 місяці тому +8

    You know it's a good day when BornCG uploads!

  • @oddlytimbotwillison6296
    @oddlytimbotwillison6296 2 місяці тому +5

    You are a true educator. These are some of the best, most thorough and well-explained tutorials I have seen for game development.

  • @noahb4399
    @noahb4399 2 місяці тому +4

    these are great tutorials! going through them all has given me ideas for a 3D platformer that I actually want to commit to and create once the series is done :D

  • @jinenjipeke
    @jinenjipeke 2 місяці тому

    cant wait for next part, i love how you remind us to take all the good habits like saving after a change to the code or adding the description in the script

  • @bloodykun4443
    @bloodykun4443 2 місяці тому

    Thank you for these, they've been a great help so far in just finding out how to get started with anything and figuring out all the ways in which you have to really think about how you code. I used Game Maker 5 and 8 many years ago, some form of RPG Maker as well, and have been working on projects in both GMStudio 2 and RPGMMV as well as GameboyStudio, much more recently. None of them have been as complicated to start out as this program it seems, understandably so with the shift to 3D for me I think, but it doesn't help I tend to rely on a lot of drag-and-drop kind of simple programming rather than actually learning how code goes together. So you really breaking this stuff down into the hows and whys and making sure to repeat processes has been very informative and makes everything feel much more manageable. I've seen some other comments on previous videos about feeling like they're back in junior high and annoyed with it, but even at 32 myself I really appreciate the way in which you don't just assume anyone who's watching is already familiar with this or that jargon. Hope to see more from you soon and will likely rewatch some of these as I go.

  • @Quadmyke
    @Quadmyke Місяць тому +1

    This series has been amazing, a great introduction to 3D in Godot, so a huge thanks! I am unfortunatley running in to a little issue I haven't seen mentioned here, every lesson up to here works great except once adding the xform.basis = xform.basis.orthonormalized() it flipped my character from left to right, character moves in the right directions, it's just the mesh flipping on the y axis. Not sure why and would apprecieate if anyone has any knowledge on this, thanks! No rush of course, I'm moving on to the next lessons in the meantime.

  • @licha11
    @licha11 2 місяці тому +1

    please continue with this very instructive videos sir

  • @saeedserwan
    @saeedserwan 2 місяці тому +1

    Happy birthday and thank you for the upload!

  • @penno4641
    @penno4641 Місяць тому

    Great tutorial, thank you very much for making and sharing this lesson.

  • @ninomojo
    @ninomojo 2 місяці тому

    Fantastic series so far, thank you so much! Could you please make a whole video just about transforms and how to think of them and how they work? I feel the whole internet would be eternally grateful :D

  • @ToriloOo
    @ToriloOo 2 місяці тому

    YES, new video, im actually using this tutorials for a fighting game, so anyone who wants to do something different can still use all the information provided, Thanks for all this BornCG

  • @noahb4399
    @noahb4399 2 місяці тому +7

    If the character is on a ramp, then jumps while not holding any of the movement keys upon landing, the character will still be angled normally on the ramp. A workaround for this is to change the if is_on_floor()... statement to "if (is_on_floor() and input_dir != Vector2(0,0)) or is_on_floor_only():". the "or is_on_floor_only()" part adjusts the character's angle if they JUST touched the floor, but not after. Hope this helps!
    Last comment I promise :P

    • @dannymac653
      @dannymac653 2 місяці тому +1

      When I implemented this, the transition tremors came back

  • @MrBrooks89
    @MrBrooks89 2 місяці тому +6

    Just started this series and been amazing so far. Can't wait for the rest to come out. I wanted to add to what others said and kind of compile it into one comment to fix the ramp issue. You need to set RayCast3D node to top level just like the camera controller node is. Then set the raycase3d position to player position and alter the if statement to add or is_on_floor_only which looks like this in the code:
    # Rotate the character to align with the floor
    $RayCast3D.position = position
    if is_on_floor() and input_dir != Vector2(0,0) or is_on_floor_only():
    align_with_floor($RayCast3D.get_collision_normal())
    global_transform = global_transform.interpolate_with(xform, 0.3)
    elif not is_on_floor():
    align_with_floor(Vector3.UP)
    global_transform = global_transform.interpolate_with(xform, 0.3)

    • @Snowby40
      @Snowby40 2 місяці тому +1

      This seems to have fixed the issue, hopefully it can be pinned

  • @mahmoud_ali_963
    @mahmoud_ali_963 11 годин тому

    Thank you very much

  • @Primal_Real
    @Primal_Real 2 місяці тому

    I love your videos they are useful and helpful and I managed to fix all the problems I had with your code on 4.3 but also I'm not being rude but the videos seem to be coming out quite slowly as it has been 11months and only 13 videos have came out but anyway I appreciate the help and effort!

  • @sayris01
    @sayris01 Місяць тому +1

    nice :)

  • @MuttonYung
    @MuttonYung 2 місяці тому +4

    Here is a solution for the edge issue: make the node RayCast3D "Top Level" and assign player's position to its position in function _physics_process. It prevents changes of the RayCast3D's rotation in world space. Also it can protect the player from an overturn, which makes the RayCast3D no longer detect the ground.
    This series is one of the best Godot 3D turorials!

    • @Sup3r3ddy
      @Sup3r3ddy 2 місяці тому +1

      Worked perfectly! Smart solution :D thank you

    • @djk1288
      @djk1288 Місяць тому

      Commenting to help boost this answer, worked for me too

    • @jammyjammingtonjam
      @jammyjammingtonjam 22 дні тому

      Very tidy solution, thanks :)

  • @capitanlopez1
    @capitanlopez1 2 місяці тому +1

    Thank you very much for the video.
    I think the raycast is not necessary. In the CharacterBody3D node there is the get_floor_normal() method.

  • @NeilRoy
    @NeilRoy 2 місяці тому

    I'm wondering if you used a timer for the orientation where it waits like, a quarter of a second or less to update, as that jittering seems to happen really rapidly... or would it only result in slower shaking? I'm curious as to what is causing the shaking if you're not moving? Why would it change when you are still? There has to be a reason. Maybe you should move a little farther each time, but maybe slower so the speed seems the same so it doesn't make such minute movements to cause that?

  • @animatorgear_
    @animatorgear_ 2 місяці тому

    Happy birthday Sir you are awsome
    Thank you so much
    can you make video on character design and walking please

  • @CAG_9446
    @CAG_9446 2 місяці тому

    Just wanted to say I'm an educator teaching my third game class for the littles and I was stressing trying to find something more thought-out than Flowlab for my course. All my kids wanted 3D development and I struggled getting Unity to work on our Mac machines so I decided to go with Godot. What an amazing series! I hope you can get most of these uploaded by next year because I am going through all of these for reference! Do you have PDF lessons on each activity? Thanks --Coffee

    • @BornCG
      @BornCG  2 місяці тому +4

      Thanks for your comment! No I don’t have the lessons / content in written format, sorry. The good news: my videos should accelerate a little come September, hopefully.

    • @KakarotSaiyan-v5p
      @KakarotSaiyan-v5p 2 місяці тому

      ​@@BornCGcan you please upload a beginner friendly UA-cam tutorial video. That teach you how to code and develop games using GD script. by illustrating step by step, how to code and make multiple games from different types and genres, by GD script and Godot. I will really appreciate it if you did this please.

    • @CAG_9446
      @CAG_9446 2 місяці тому

      @@BornCG no problem, thank you for the videos! I'll see if I can convert them into a PDF format for future lessons.

  • @NahrAlma
    @NahrAlma День тому

    Well, I kinda skipped the part on the camera following the character and just attached it to my player, but now changing the global transform also messes up the camera. Back to video #9 I go 😄
    Edit: I'm back. Now I'm having some new issues. 😆 I'll get there in time. Even the great masters of old stumbled through their early years!
    I had this wobble back and forth on my bottom ramp because I put another block underneath it and it was swapping back and forth. I shortened the ray cast to -0.1 and it fixed that for me. But then I also had weird issues like my character shrinking and dropping through the map and so on.

  • @ReverofEnola
    @ReverofEnola 21 день тому

    Thank you for the tutorial but for some reason my character turned giant after implementing this code.
    Is there anyway to change him back?

  • @begonedamen
    @begonedamen Місяць тому

    Hate to bother you, but is there a way to do this purely visually? Like, only apply the rotation to an animated rig?

  • @YTFunobbyYT
    @YTFunobbyYT 2 місяці тому +1

    when i just walk on the floor, my block is doing crazy stuff like rotating because of the block extrude i did.. how to fix that without having to completely modify the map

  • @BiscottoPlays
    @BiscottoPlays Місяць тому

    As a beginner this was absolutely super helpful and well made, sadly found out like halfway through that it won't work for rigidbody based characters. Which should have been obvious in hindsight 🤦

  • @jasonwilliams8730
    @jasonwilliams8730 2 місяці тому

    👍

  • @noahb4399
    @noahb4399 2 місяці тому +2

    One issue I encountered is if you transition from one ramp angle to another on a corner ramp, they'll still keep the original angle and look slanted. Did anyone else encounter this? Any tips for fixes/workarounds?

  • @wyattblends7643
    @wyattblends7643 2 місяці тому

    I've been following this series. It'd be awesome to be able to join a discord community if you have one

  • @PhyoeSiThu-du7yq
    @PhyoeSiThu-du7yq 2 місяці тому

    Hello BornCG, I want to ask you. My laptop has not external graphics card eg,gtx and rtx. Without gpu, can I use Blender for long term?

    • @BornCG
      @BornCG  2 місяці тому +1

      Depends what you want to use blender for. If you want to render Pixar level animations with hundreds or thousands of frames, you’ll need to upgrade cone render time realistically. If you’re doing simpler work or just learning, you can go a long way with a basic laptop.

    • @PhyoeSiThu-du7yq
      @PhyoeSiThu-du7yq 2 місяці тому

      @@BornCG thanks

  • @robesterclips
    @robesterclips 2 місяці тому

    I have an issue where when I add the Xform my character no longer falls to the ground, it stays in the air in the same place and I still have full control of the camera and the character's orientation but it does not move. does anyone know why this might happen, when I delete it all it works again. I have followed the entire series so I haven't changed anything and I'm on Godot 4.3 if that's an issue.

  • @deepheartstories
    @deepheartstories 2 місяці тому

    Thanks once again. Can you please upload the important parts of this series as soon as possible? I would like to enter BRACKEYS game jam.

  • @EnchantedWolf-ey3gc
    @EnchantedWolf-ey3gc Місяць тому

    My player object falls through the floor and I can't really figure out how to fix it, but it does stay on the floor if I take away the global_transform = xform so I don't really know what to do.

    • @EnchantedWolf-ey3gc
      @EnchantedWolf-ey3gc Місяць тому

      I fixed it!!!! If anybody else has the same issue it's because the code on line forty for him has to be double tabbed

  • @blandon93
    @blandon93 2 місяці тому

    bro in my top_ramp model collision is wierd. I cannot walk up on it without lower ramp and the character stumbles upon it. I did blender just like in your video. Remaking the model did not solve the issue.

  • @WUKONG2002
    @WUKONG2002 18 днів тому

    Align_with_floor ()
    Is not working . Please help me to resolve the problem.

    • @WUKONG2002
      @WUKONG2002 18 днів тому

      My character go straight down to the floor

  • @rifkyriezz2936
    @rifkyriezz2936 2 місяці тому

    Helo mr BornCG, can you tell me how to make all this asset/ or is there asset can I download it ?

    • @andreaang9448
      @andreaang9448 2 місяці тому +1

      theres a guide for asset making in part #10 and #11 of this series

    • @rifkyriezz2936
      @rifkyriezz2936 2 місяці тому

      @@andreaang9448 thanks

  • @PastaMaster115
    @PastaMaster115 2 місяці тому +1

    For some reason my character doesn't align with the normals. Instead it just goes flat and falls through the floor. I'm using your code exactly. I'm getting thousands of errors saying '"det==0" is true'. I don't know what's wrong on my end. Here is my code. It's before the smoothing. I figured there isn't any reason to continue on with the smoothing if my character doesn't do the thing in the first place lol
    var xform : Transform3D
    #Rotate character to align with floor
    if is_on_floor():
    align_with_floor($RayCast3D.get_collision_normal())
    global_transform = xform
    func align_with_floor(floor_normal):
    xform = global_transform
    xform.basis.y = floor_normal
    xform.basis.x = -xform.basis.z.cross(floor_normal)
    xform.basis = xform.basis.orthonormalized()

    • @BornCG
      @BornCG  2 місяці тому

      Is your call to align with floor indented correctly?

    • @PastaMaster115
      @PastaMaster115 2 місяці тому

      @@BornCG The comment might show it a little wonky but yes, in my editor, everything is indented correctly.

    • @KakarotSaiyan-v5p
      @KakarotSaiyan-v5p 2 місяці тому

      ​@@BornCGcan you please upload a beginner friendly UA-cam tutorial video. That teach you how to code and develop games using GD script. by illustrating step by step, how to code and make multiple games from different types and genres, by GD script and Godot. I will really appreciate it if you did this please.

    • @devdanielplays...7519
      @devdanielplays...7519 2 місяці тому +2

      A quick Google suggests that error is caused by something equalling 0 that shouldn't be.
      If by "flat", you mean your character is appearing 2D-ish, that might indicate the affected axis.
      I would try adding `print(floor_normal)` to check the floor normal looks correct, then `print(xform.basis)` before the orthonormalized line to make sure you don't have a bunch of zeroes.
      It's then worth checking that your objects are set up exactly as per the video.
      Good luck!

    • @PastaMaster115
      @PastaMaster115 2 місяці тому

      @@devdanielplays...7519 The affected axis is y. The floor normals for flat surfaces are (0,1,0) as they should be. The The xform.basis before orthonormallized is
      [X: (0, 0, 0), Y: (0, 0, 0), Z: (0, 0, 1)]
      The Y should be (1,1,1), right? I don't know why the Z has a 1 when I'm on flat ground.

  • @SovereignVis
    @SovereignVis 2 місяці тому +1

    I have corner ramps in my level and if the character stops on a corner like you did at the top of the ramp the character's direction gets shifted out of alignment where it is moving forward while facing about 10 or 20 degrees off of the direction it is moving. 🥴