3D Movement in Godot in Only 6 Minutes

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

КОМЕНТАРІ • 376

  • @Gdquest
    @Gdquest  Місяць тому +2

    📣📣 *UPDATE !!* GODOT 4 REMAKE now available: ua-cam.com/video/JlgZtOFMdfc/v-deo.html 📣📣

  • @jerbid_
    @jerbid_ 2 роки тому +330

    For Godot 4, I found that the .translation property was renamed to .position, and rotation_degrees is just rotation.

    • @Warionator
      @Warionator Рік тому +39

      good info! additionally, set_as_toplevel(true) is now set_as_top_level(true)

    • @Warionator
      @Warionator Рік тому +38

      Update: As of Godot Beta 4 v10,. they added back rotation_degrees

    • @canhedotricks6078
      @canhedotricks6078 Рік тому +2

      THANK YOU!!

    • @netoaraujo9790
      @netoaraujo9790 Рік тому +2

      Thank yoou!! 🤩

    • @thiagoborges2920
      @thiagoborges2920 Рік тому +6

      This should be pinned

  • @TheGamerprod
    @TheGamerprod Рік тому +103

    Kinematic body has been changed to character body in Godot 4

    • @ROCKDUM
      @ROCKDUM 9 місяців тому +5

      Thank you!

    • @-cottoncandy-
      @-cottoncandy- 5 місяців тому

      tysm !!

    • @RubyPiec
      @RubyPiec 5 місяців тому

      tysm omg i'd be so lost without this

    • @WeirdBrainGoo
      @WeirdBrainGoo 3 місяці тому

      So do we just emit the parts related to snapping, or...?

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

      You dropped this, King👑

  • @Chafmere
    @Chafmere 3 роки тому +200

    I spent months setting up 3d camera. Had no idea spring arm existed. Would have saved me so much time.

    • @andrewsneacker1256
      @andrewsneacker1256 2 роки тому +5

      how and why

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

      @@andrewsneacker1256 I was new and I wanted to make a 3d camera rig similar to the Zelda games. I didn't know the spring arm existed I spent a long while making it but it was mostly for fun and to explore the engine. I made a video about it here. It's kind of old but it goes over my process. ua-cam.com/video/uVeZVHgXcSU/v-deo.html

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

      Ha

    • @LoganParks-q9n
      @LoganParks-q9n Рік тому

      @@AriaOrAriesf u

  • @MrKashyr
    @MrKashyr 3 роки тому +69

    This comes like fallen from heaven, I've been trying for the past two days to accomplish exactly this. Thank you!

  • @comedyclub333
    @comedyclub333 2 роки тому +139

    When combining a capsule with a cylinder you can get a capsule with a edge peaking out. This way you have the smooth movement on slopes but still don't completely fall off platforms.

    • @coluix
      @coluix 2 роки тому +10

      That's genius

    • @wolcamophone4783
      @wolcamophone4783 2 роки тому +23

      I ended up making my own collision shape in Blender that's a cylinder with shaved edges so you still slide but have a flatter service for standing on ledges and people's heads.

    • @comedyclub333
      @comedyclub333 2 роки тому +5

      @@wolcamophone4783 That's also a good idea.

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

      @@wolcamophone4783 And that’s why these communities are so useful. Simple idea but useful one! Thank you!

    • @NobleAbsinthe
      @NobleAbsinthe 7 місяців тому

      In trying to visualize the Collison body. Would it basically be like a pig in a blanket? A capsule that is inside a bigger cylinder with the top and bottom nubs poking put?

  • @novemberdev8292
    @novemberdev8292 3 роки тому +183

    For anyone wondering how to make the character smoothly look at it's direction, check spherical linear interpolation out:
    # set this from a parent Rigid- or KinematicBody's script
    var direction = Vector3.FORWARD
    func _process(delta):
    direction.y = 0
    global_transform.basis = smooth_look_at(global_transform, global_transform.origin - direction, delta)
    func smooth_look_at(t : Transform, dir, delta):
    return t.basis.slerp(t.looking_at(dir, Vector3.UP).basis, delta)
    Make sure to not do any scaling on the model you want to rotate. Ideally you have a Rigid- or KinematicBody with a Model node inside that you rotate around...

    • @RealSnowbun
      @RealSnowbun 3 роки тому +9

      Thank you 😭😭

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

      Made it a lot more simple. In the players script in this video I just changed rotation line "_model.rotation.y = look_direction.angle())" to
      "_model.rotation.y -= (_model.rotation.y - look_direction.angle())*delta*rotation_speed"
      where "rotation_speed" is a variable exported and placed with all other exports at the beginning. Would it be better?

    • @konstantingolubev3822
      @konstantingolubev3822 3 роки тому +30

      Oh, there was a mistake, the line should be : _model.rotation.y = lerp_angle(_model.rotation.y, look_direction.angle(), delta * rotation_speed)

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

      @@konstantingolubev3822 ok

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

      Thanks 👍

  • @wolcamophone4783
    @wolcamophone4783 2 роки тому +50

    I'm pretty sure the player controller shown in the preview here is tweaked way better in the code besides what's shown, besides having a fully animated player model of course. Encountered some weird bugs:
    -I manually adjusted the springarm to the neck height of my model but it's still on the floor. I know the camera at least works cause it's the proper springarm distance away. (Still not fixed)
    -I can't rotate the camera with any mouse movement. (Change func _unhandled_input to just _input)
    -My character moved in opposite directions than what they were supposed to for left and right. (Fixed by swapping left and right input names in code.)
    -The character likes to immediately reface north for some reason if jumping in place. The code for facing the mesh forward does not discern between just the horizontal vector and any direction of velocity taken. (Temporary fix by adding "var look_direction..." lines of code under "if is_on_floor():" so that the character at least keeps his rotation in the direction he jumped) (New Fix: As of 4.0.1 stable mono, "character bodies" now have better physics variable built into the default scripts. You can now generate a template script to call these variables for basic movement for you so you don't need to manually define _velocity from move_and_slide_with_snap! Character now rotates and stays properly with built in velocity variable for our look_direction variable!)

    • @deiticphantom8449
      @deiticphantom8449 Рік тому +3

      Thank you :)

    • @lyghtkruz
      @lyghtkruz Рік тому +3

      I dunno if you ever found a fix, but you can simply adjust the height of the camera by adding a vector3 to your player scene and doing addition to the translation(position). var camera_offset: Vector3 = Vector3(0, 2.5, 0) # the middle is Y so put your height offset in meters. Then in the line to set the translation (which is now called position) you do spring_arm.position = position + camera_offset. As for the _unhandled_input() every script can have an _unhandled_input and it will be called as long as no other nodes set the input as handled. If they are, that's causing your problem. I can't tell without actually looking at your code, but I used the _unhandled_input a lot as a hack to be able to press ESC and get pause menus and things to come up without having to code the input into a specific player or level scene.

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

      @@lyghtkruz Thank you, this helps a lot. I might try changing my pause script first then since that seems simplest and it uses the regular _input() function. I also use G 3.5 so idk if that has some issues between G4 but my knowledge is still minimal.

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

      @Wolcamophone oh, the translation is only position in godot 4. Sorry for any confusion. Been using 4.0 for a while now.

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

      @@lyghtkruz Thanks for the heads up. I'm still not sure how I'd set up translation scripts as I still don't know if I could code a respawn node for the player falling out of the world.
      Also since I got your attention, what do you think would be a good game object to attach the regular input function to?

  • @marc.silden
    @marc.silden 2 роки тому +11

    I'm a newby just like many who are watching this video... Hey, don't give up! Watch this video everyday (not hard because it's a short one) and read the Godot Docs as well to learn more about all those things that are showed in the video. You'll see.
    Thank you again, GDQuest. Great tutorial.

  • @jeffreystephens2658
    @jeffreystephens2658 Рік тому +3

    Excellent! Got me up and running right away. Thanks for this!

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

    I'm so hyped I've subscribed to this channel! This is great content!!!

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

    It really worked for me after I look and try some tutorials, yours is the one that worked. Owe you a lot.

  • @livvy94
    @livvy94 2 роки тому +15

    Do you need to add a colission shape like this for every character? Surely there's a way to reuse the same one?
    How do you know what all these nodes and things you're adding are and what tey do?
    1:07 How does the character have an idle animation already?
    1:49 Where is all this code coming from!?!?
    gaaaaaahhhh I'm so overwhelmed

  • @NarekAvetisyan
    @NarekAvetisyan 2 роки тому +12

    Very cool! Are you guys working on a course for Godot 4? I'm totally new to game development and after trying out Godot 4 alpha and seeing how fun it is, as opposed to Unreal 5 that's very overwhelming, I'm 100% set on making a 3D game like the one you show here.

  • @John_Henry83
    @John_Henry83 3 місяці тому

    I wish that I had found this video five months about when I first installed GODOT. It would have cleared up so many things that I have been googling for hours.

  • @biggierocc1935
    @biggierocc1935 6 місяців тому +3

    Quick question: Everything works perfectly fine except the character faces the complete opposite direction of where they're supposed to. Any idea what's going wrong?
    I have no idea what could've caused it but I did manage to "fix" it by adding 180 degrees in radians when I convert the look direction to radians

    • @tamerxero
      @tamerxero 5 місяців тому

      I'm also having this issue, did you figure it out?

  • @bombrman1994
    @bombrman1994 5 місяців тому +5

    move and slide with snap is changed now to move and slide only, also im watching this and translating the api in my head into c# code

    • @a_a210
      @a_a210 3 місяці тому

      i'm new and do am stuck because of the change what should i do now

  • @_SereneMango
    @_SereneMango Рік тому +2

    Took me a while to understand why my character would just face back to global angle 0°, specifically when there was vertical movement while I was doing no movement input... The solution was using a Vector2 for length(): instead of using _velocity directly, I created a Vector2 variable with _velocity x & z only instead.

  • @Seckie
    @Seckie 3 роки тому +8

    I wish you would provide the complete code.

  • @lemenipocketshadow
    @lemenipocketshadow 2 роки тому +6

    So I was having problems with the camera not following/orbiting the kinematic body it and the spring arm was attached to. After pulling my hair out a while, I figured out it was b/c the kinematic body wasn't the root node. I tend to have a basic node as a root node(in this case, a spatial node), but that completely messed up the cam orbit. I always thought the base nodes worked more like folders, so I didn't think that was the thing messing it up.

  • @Ragnarsun023
    @Ragnarsun023 2 роки тому +22

    extends KinematicBody
    export var speed:float = 2.0
    export var jump_force:float = 30.0
    export var gravity:float = 50.0
    export(NodePath) onready var _spring_arm = get_node(_spring_arm) as SpringArm
    var _velocity := Vector3.ZERO
    var _snap_vector := Vector3.DOWN
    onready var _model := $AstronautSkin as Spatial
    func _physics_process(delta:float)->void:
    var move_direction := Vector3.ZERO
    move_direction.x = Input.get_action_strength("right") - Input.get_action_strength("left")
    move_direction.z = Input.get_action_strength("back") - Input.get_action_strength("forward")
    move_direction = move_direction.rotated(Vector3.UP, _spring_arm.rotation.y).normalized()

    _velocity.x = move_direction.x * speed
    _velocity.z = move_direction.z * speed
    _velocity.y -= gravity * delta

    var just_landed := is_on_floor() and _snap_vector == Vector3.ZERO
    var is_jumping := is_on_floor() and Input.is_action_just_pressed("jump")

    if is_jumping:
    _velocity.y = jump_force
    _snap_vector = Vector3.ZERO
    elif just_landed:
    _snap_vector = Vector3.DOWN

    if Vector2(_velocity.z, _velocity.x).length() > 0.2:
    var look_direction = Vector2(_velocity.z, _velocity.x)
    _model.rotation.y = look_direction.angle()
    _velocity = move_and_slide_with_snap(_velocity, _snap_vector, Vector3.UP, true)

    pass
    func _process(_delta)->void:
    if _spring_arm != null:
    _spring_arm.translation = translation
    pass

    • @Ragnarsun023
      @Ragnarsun023 2 роки тому +8

      extends SpringArm
      export var mouse_sensitivity := 0.05
      func _ready()->void:
      set_as_toplevel(true)
      Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
      pass
      func _input(event)->void:
      if event is InputEventMouseMotion:
      rotation_degrees.x -= event.relative.y * mouse_sensitivity
      rotation_degrees.x = clamp(rotation_degrees.x, -90.0, 30.0)
      rotation_degrees.y -= event.relative.x * mouse_sensitivity
      rotation_degrees.y = wrapf(rotation_degrees.y, 0.0, 360.0)
      pass

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

      Nice mate

  • @incorporealnuance
    @incorporealnuance 3 роки тому +7

    Followed the instructions in the video exactly, _to the letter,_ and it barely works at all. You can only see the player when they jump for some inexplicable reason. Mouse input doesn't register at all so I had to rebind it to keyboard keys in 45 degree increments. The rotation of the character is reset when jumping, which I never found a fix for. Is this tutorial for a completely different version of Godot than the latest update or something?? Is there a demo to show this code even working correctly? Because the code as shown does NOT represent what actually happens on-screen.

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

      I found a solution to the first issue. For me it was something like this: I could see the player but the camera would snap into the player when viewed at >45°. I had to change the collision layer for the player (the spring arm was colliding with the player and forcing the camera into the player).

    • @Kruemo
      @Kruemo 2 роки тому +5

      Update: Found a fix to the position resetting: Line 34 ("if _velocity.length() > 0.2"). Change it to if Vector"(_velocity.z, _velocity.x).length() > 0.2: (if you stand still and jump your velocity length will be > 0.2 but since the rotation is based on x/z axis not y (up down) the rotation resets to default. Tbh I think the rotation should be solved differently in the first place (save it a variable or something, idk).

  • @martindavy7201
    @martindavy7201 2 роки тому +5

    Tutoriel incroyable ! superbe vidéo merci beaucoup ça va me remotiver à utiliser Godot =)

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

    can someone explain to me how the springarm actually works ? for some reason it always keep my camera at the height of my model's feet
    ok, i figured it out. the issue was in the collision mask

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

    I follow you step by step, but for me the camera is in front of my character,
    my movement is inverted and for some reason camera behave very strange on certain angles

  • @JeepJumpJr
    @JeepJumpJr Рік тому +3

    Fantastic tutorial. Do you have any plans for making a new one for Godot 4?

  • @synthgal1090
    @synthgal1090 2 роки тому +9

    Is there an expanded version of this tutorial that actually explains what's going on or am I supposed to just type these things on faith?

    • @Manical
      @Manical 6 місяців тому

      Faith and works in diligently finding the meaning of those words

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

    This is great. I had a C++ class in college that i barely remember, and this feels like EXACTLY what i'm looking for to get going again and maybe actually learn something.

  • @pastellepuppy
    @pastellepuppy Рік тому +2

    Line 10:
    'onready var _spring_arm: SpringArm = $SpringArm'
    keeps giving me the error 'Unexpected "Identifier" in class body,' possibly due to the fact that there is a new default name for the SpringArm, which is SpringArm3D. How can I fix this?

    • @pastellepuppy
      @pastellepuppy Рік тому +3

      Never mind, I fixed it! I am using Godot 4, and you now have to use @onready instead of just onready

  • @bmc757
    @bmc757 2 роки тому +14

    Hi, I'm having an issue with the character rotation, where the character's rotation snaps back to its starting direction whenever I jump. Has anyone else had this same issue, and did you find a solution? EDIT: Solution (gives smooth rotation and keeps rotation consistent while jumping):
    if Vector2(_velocity.z, _velocity.x).length() > 0.2:
    var look_direction = Vector2(_velocity.z, _velocity.x)
    _model.rotation.y = lerp_angle(_model.rotation.y, look_direction.angle(), delta * rotation_speed)

  • @randomnyyStrannik
    @randomnyyStrannik 3 роки тому +3

    Do you have a tutorial about making this cute 3d robot?

  • @xX-DogSama-Xx
    @xX-DogSama-Xx 3 роки тому +8

    question: I've been trying to adapt this to have the player speed up the longer you hold the button and to slow down once released. I've gotten it to "work", but the deceleration breaks as soon as you rotate the camera. It works as intended when the camera is in it's default position relative to the player, but as soon as you move it the player starts to shake and spin really fast in place until its speed returns to 0, any idea what could be going wrong?

    • @tumbleweb
      @tumbleweb 2 роки тому +5

      The line "move_direction = move_direction.rotated(Vector3.UP, _spring_arm.rotation.y).normalized()" is resetting your movement vector based on the camera's rotation.
      I don't know how one would go about solving this, but that is definitely related to your issue! My first guess is try making a temporary variable that stores the "momentum" perse and re-apply it to the movement vector once the camera's rotation changes?

  • @haoumaru8907
    @haoumaru8907 2 роки тому +5

    Great tutorial everything is working, but i am just sad that you didn't say how to implement the animation to this kind of movement. I made some stuff to my game including dmg system, moving platforms and other obstacles but I can't figure out those movement animations 😞

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

    Please make one about animations, animationTree and state machine, how to implement this in player script

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

    the camera is not woking

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

    Lol having to do all these details in unity myself made me realise how much better godot is in regard to having basic things like these covered by default.

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

    it would have been very helpful to start with "Here is how you add a character from a model" or at least link to some resources for that lol, it's all well and good to have a collision shape that matches your character, but it doesn't help me add my character.

  • @jadelily18
    @jadelily18 3 роки тому +14

    emberlynn's voice brings me joy :)

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

    This is a really important tutorial, I needed to do exactly this in my project and wasn't able to find any guide. Thankfully things ended up working out but it cost me a lot of time to figure everything out.

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

      That's kinda the downside to picking Godot

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

    2:52 Why do you multiply with delta? The physics process has a static frame rate (usually 60)

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

    Best tutorial ever, thank you so much !

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

    Please could you tell me what script does Godot handle and where to learn this language? I want to make a super simple video game, but I don't know anything about programming writing, but I can do everything in 2D art

    • @-HyperX-
      @-HyperX- 3 роки тому +9

      Welcome to gamedev! Godot uses the gdscript programming language. It's very easy to learn, and a lot like the popular programming language Python. Since you have no programming experience, I'd personally recommend either waiting for the Learn to Code with Godot from Zero course to be finished, or to learn another language like Python. Then once you have the basics down, it should take you only a couple days to pick up gdscript.

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

      The reason for this is because to learn programming, you need to learn 2 things: How computers understand programming (Functions, variables, etc.) and syntax. (Syntax is just the rules of a language) Most Godot tutorials are great about teaching the gdscript syntax part, but expect you to know the other part. The good news is, once you learn how computers understand code, it's much easier to pick up new languages!

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

      @@-HyperX- and there is a third part: APIs.
      APIs are the functions that give you access to all the wonderful ready-made functionality in the engine, library or framework you are using.
      If you can already code in one language then GDScript is very easy to learn as the syntax is simple - the APIs are also something you need to learn next

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

    Can someone help me pls??it just wont work...i try oder tutorial and it wont let me move in 2d i can move but in 3d no...btw camera works perfecly...sori for bad english

  • @Spooky90097
    @Spooky90097 3 місяці тому +1

    amazing tutorial

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

    This is a really good tutorial. Would you be willing to go more in depth as to how spring arms work in a future video? I can't seem to get mine to move with the player.

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

    Omg ty i was looking for new version tuturial you are life saver

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

    In kinematic body, I don't have the option physics body do you know the solution for it
    If yes please let me know

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

    Could someone possibly explain how one might add acceleration to the character movement? Tried a few things that didn't seem to work and I'm at a loss

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

      when the input is recieved, instead of setting speed to a value set acceleration to a value (0 when the key isnt pressed). then change the velocity by the acceleration. you will also need a deceleration variable. change velocity by subtracting deceleration when the button isnt pressed, but if the velocity is less than the deceleration set velocity to 0
      sorry for the bad explanation

  • @5ucur
    @5ucur Рік тому

    The camera is stuck below the character, even if I move back and up the SpringArm, and even if I do the same to the Camera, it still displays from the feet of the character. What mistake have I made?
    Edit: Worked around that by using a Position3D instead. Now, the character rotates the opposite way, while everything else works perfectly, including the movement direction.

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

    i really apreciate your help with dowloanding this software

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

    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 ???

  • @bodamat
    @bodamat 3 роки тому +3

    I love this tutorial! This is amazing, easy to understand and correctly use Godot :) Thank you 😍

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

    Life saver, thank you so much!

  • @velsia1
    @velsia1 Рік тому +2

    I have no fucking idea what I'm writing but if it makes my character move, that's fine.... c++ is freakingly easier to read and comprehend than gdscript

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

    What is the name of the 3D Player Model that is used in the video? Thank you!

  • @kaduyeah
    @kaduyeah Рік тому +5

    how do you use the move_and_slide_with_snap on godot 4?

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

      i have the same problem, let me knoe if you find it :/

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

      @@HitCoder No luck here bud :(

    • @a_a210
      @a_a210 3 місяці тому

      @@kaduyeah found it yet?

    • @kaduyeah
      @kaduyeah 3 місяці тому

      @@a_a210 nop

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

    this seems to more or less work fine for me, but i've run into an issue where if the player starts anywhere except at the center of the map and slightly below "ground" (like where the editor draws the grid, i don't know what else to call it), the camera breaks in some way or another? like if the player starts too high up the camera is stuck in/under the floor and if they're not in the center then the camera stays in the center without them and moves really weirdly. it's technically ignorable if i make every map with that in mind, but it's pretty annoying...if i decided i wanted so much as the player to start facing a different direction i'd have to rotate the entire map to accommodate that.
    i tried adding some code to fix this myself but it didn't seem to work...i figured the issue was basically the camera doesn't directly inherit the player's position so what i did was under "set_as_toplevel(true)" in the camera code i added "translation = _playerloc.translation" (with "_playerloc" there being a variable to refer to the kinematicbody node or the player spatial node, i tried both but neither did anything)
    idk if anyone has any ideas on what's up with this it'd be helpful...i'm surprised nobody else seems to have mentioned this problem? i'm 99.9% sure all my camera code is the same as the video, the only thing i added was something to zoom the camera in and out with the scroll wheel but i had this problem before i added that...i can deal with it if i have to but i'd rather just have the thing be like...normal

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

      I don't know you figured it or not,
      for going slightly under ground check your collision shape position, try moving the player mesh and collision shape exactly centre of the workspace it fixed my camera issue

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

    Should’ve gone over character animation. Would’ve definitely saved me a headache while trying to get it right.

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

    the camera partly worked basically it was able to be moved up and down but not left and right and every time I pressed W A S or D my capsule kind of just tilted can somebody please tell me why.

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

    i love how u blur ur search history

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

    Haven't worked for me.
    Gives me an error that length() can't work with vectors
    makes sense,but why is it in tutorial tho?has it been working before and now stopped?

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

    I followed the tutorial using Godot 3.4 and noticed that my spring arm & its camera is fell to the floor. Anyone can help with this problem? Thank you

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

      Simple Under
      spring_arm.translation = translation
      Add
      spring_arm.translation.y = translation.y + 1.375

  • @seeking9145
    @seeking9145 7 місяців тому

    Rigid body -> (R) -> realistic
    Kinematic body -> (K) -> Controll (c sounds at least like an k 😅)

  • @IsaiahCuriel-pg5eg
    @IsaiahCuriel-pg5eg Рік тому +1

    The (Vector3.Up, _spring_arm.rotation.y) is not working for me. Is anybody else having this problem?

  • @sweettea-hv1ls
    @sweettea-hv1ls 10 місяців тому

    It's cool, but is it possible to make like so it will incline towards movement direction. I don't know how to say it but like realisticly

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

    You can roate the capsule collider?! Take that, Unity!

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

    The player script didn't work for me when it was attached to the root of the player scene.
    But when I attached it to the player node in my level scene it worked.

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

    Thank you for your awesome videos.

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

      I think the problem is that [ if _velocity.length() > 0.2: ] still triggers if only _velocity.y is greater than 0.2, so to fix it all you have to do is remove _velocity.y from the equation. I'd try either [ if (_velocity * Vector3(1, 0, 1)).length() > 0.2: ] or [ if Vector2(_velocity.x, _velocity.z).length() > 0.2: ]
      There's probably a better way of doing it though, I'm a near-total noob.

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

      Best thing to do is to convert the velocity vector into a vector2 which - as EpicallyAverageDude suggested - takes Y out of the equation. Normalizing the vector basically scales each value of the vector (x,y and z) into a value between 0 and 1 and getting the length of that gives the average magnitude of that vector.
      The only values we care about for look direction is X and Z - the 2D vector representing direction in respect to the ground. So we convert the vector3 to vector2 by just ommitting the Y value and then checking the normalized length of that vector.
      var velocity2D = new Vector2(_velocity.x, _velocity.z)
      if velocity2D.normalized().length() > 0.2:
      # Do rotation
      Hope this helps :)

  • @Warlock_UK
    @Warlock_UK 4 місяці тому

    I think export is @export in godot 4 for anyone new to it like me :)

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

    Why do you put ":" before "=" when defining a variable?

    • @noid3571
      @noid3571 3 роки тому +9

      GDScript uses : to define variable type, for example var x : int is telling Godot that this variable is supposed to be a whole number and you can add the value later. When you set the value when defining the var you can type := or leave a blank space in between : = and Godot will figure out what type of data you are giving it and assign its type automatically

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

      @@noid3571 But doesn't = do the same? I come from python so sorry if I got something mixed up

    • @dugtrioramen
      @dugtrioramen 3 роки тому +10

      @@ralfwright just using = makes it a dynamic variable, which is slower and doesn't have the best autocompletion. Using := makes Godot infer the type, and it gets optimized for performance + better auto compete. It'll also now catch errors if you try to store something that isn't the right type into that variable

    • @ralfwright
      @ralfwright 3 роки тому +3

      @@dugtrioramen ah ok. Thanks! 👍

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

      @@noid3571 Oh, thanks for the help!

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

    Silly question... How do I alter the height of the camera.
    I tried manually moving both the camera's node and then the spring arms node but the main XYZ is still the floor.
    can you help me?

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

    Is this scene and character available somewhere please? It reminds me of Astroneer. I'd love to follow along with the tutorial.

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

    So, everything works...BUT. Why is my mouse spinning crazy when i move my mouse?

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

    I could not get a mesh in because I didn't know how or where you got that character from.

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

    why dosent this work?
    export var speed := 7.0
    export var jump_strength := 20.0
    export var gravity := 50.0

    • @user-un2vb8mr6e
      @user-un2vb8mr6e Рік тому +1

      in godot 4 you must use @export instead of just export, so:
      @export var speed := 7.0
      @export var jump_strength := 20.0
      @export var gravity := 50.0

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

      @@user-un2vb8mr6e thanks

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

    How can I save a game with Godot. I am making a Drifting game and need to save the colors and specs of each vehicle.
    Will a res file work because I am planning on instancing the vehicles in the garage.

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

    how would I get the spring arm to move with the right stick on a controller rather than just the mouse?

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

    KinematicBody doesn't exist when I try to add it??

    • @Tcrakman
      @Tcrakman Рік тому +4

      It was renamed to CharacterBody3D in Godot4

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

    Nice informative video as always thank you .i have a doubt how can i implement the same thing in 2d in godot4

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

    when I put in move_direction it says unexpected token: move_direction, how do I fix that?

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

    Will we ever see one of these micro tutorials for 3D character animation? Or is that too much to fit in to this kind of video format?

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

      You'll find much better animation tutorials elsewhere. Here's an excellent animator and instructor: ua-cam.com/users/PierrickPicaut_P2DESIGN

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

      @@Gdquest thanks for the response! I just mean as far as implementing them into finite state machines and such.

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

    Hey uh, at line 24 of the first script godot detects it as an error and i dont know if it could brake my character

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

    My caracter is not moving the camera works fine and the player rotates when movement inputs are pressed but it dosent move why pls help void:
    var move_direction := Vector3.ZERO
    move_direction.x = Input.get_action_strength("right") - Input.get_action_strength("left")
    move_direction.z = Input.get_action_strength("back") - Input.get_action_strength("forward")
    move_direction = move_direction.rotated(Vector3.UP, _spring_arm.rotation.y).normalized()

    _velocity.x = move_direction.x * speed
    _velocity.z = move_direction.z * speed
    _velocity.y -= gravity * delta

    var just_landed := is_on_floor() and _snap_vector == Vector3.ZERO
    var is_jumping := is_on_floor() and Input.is_action_just_pressed("jump")
    if is_jumping:
    _velocity.y = jump_strenght
    _snap_vector = Vector3.ZERO
    elif just_landed:
    _snap_vector = Vector3.DOWN
    _velocity = move_and_slide_with_snap(_velocity, _snap_vector, Vector3.UP, true)


    if _velocity.length() > 0.2:
    var look_direction = Vector2(_velocity.z, _velocity.x)
    _model.rotation.y = look_direction.angle()


    func _process(_delta: float) -> void:
    _spring_arm.translation = translation

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

    is there any github page, it's hard to glance the code from video alone,
    github would be nice

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

    This is really useful until you try it and find that you need to call the functions. Where do I call them?

  • @Tempo918
    @Tempo918 7 місяців тому

    i have some questions, i am an absolute beginner and idk how to add a character to the game, is there anywhere i can get one from? is there any way to add a jetpack? and finally idk if i should use godot the only other thing ive used is scratch (for 3 years)

    • @Gdquest
      @Gdquest  7 місяців тому +1

      Check out our short about open source demos and assets. You can definitely get our 3D characters from our github repo.
      ua-cam.com/users/shortssqp98PGszkM
      And you can definitely use Godot. If you're still learning how to code, try the free app to Learn GDScript. You can find it on gdquest.com.

    • @Tempo918
      @Tempo918 7 місяців тому

      @@Gdquest thanks :) people have said gdscript is similar to python, and i know some python, so thats why i picked godot ( and its free)

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

    Yo I wanted to back up the kickstart but the time ended today! How I can help I would love to get the lifetime Godot mega course

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

    how do i add a model into godot? i cant make models so i download models i want to use but i cant use any of the downloaded models or add the models into blender to export them that way.

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

      Check out CGDive's tutorial, "Blender to Godot: Rigged Character Workflow". I followed that tutorial besides this one and it covers everything about importing the model

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

    BROOO thankyou so much, this really helped and the tutorial was really easy to use as well :)

  • @gim-ori
    @gim-ori Рік тому

    it's great! thanks!

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

    Can anyone help me on how to implement this in Godot 4 ?

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

    Cant we have two different variables
    Jump speed and jump height?

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

    i've noticed that in most of tutorials people use collision shapes based on primitives for their own character models. Is it a bad practice to just use auto generated collision shapes from the mesh in the engine ?

    • @imberny
      @imberny 3 роки тому +3

      It's generally for performance reasons (and also because simpler generally means fewer sources of bugs). Simple convex shapes are much quicker to check. However, the old wisdom on performance is: don't bother unless you're noticing slowdowns. So keep using your full mesh collision shapes if they don't drop frames!

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

    I carefully did everything this tutorial says, and nothing works properly. The camera have a weird rotation, when the character jumps he flies and the model faces anywhere. It does NOT work on Godot 3.5.1

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

      Well this video was created a year ago using an older version of Godot... Some methods used have been changed... You can't follow this tutorial blindly and expect it to work unless you're using the same version they are. I assume they used Godot 3.3.4 in this video.
      And you wrote 'nothing works properly', what exactly was not working as intended? If you're looking for help you should comment the error and have people bugfix for you if you're too incompetent to do it yourself?🤷🏼‍♂

    • @just.tiramisu
      @just.tiramisu Рік тому

      im on 3.5.1 and it works fine

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

      @@just.tiramisu Me too but I had to adjust the code obviously due to deprecations. This code doesn't transfer directly to 3.5.1

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

    This works fantastically! Thank you so much.
    Is there a tutorial or fix that can help prevent my character running up slopes that should be to steep?
    When I encounter a wall with a slight angle, my character shoots up and over like a slingshot.
    Is there a way to restrict movement when confronted with step angles?

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

      I'm having the same issue, I think it has something to do with move_and_slide()

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

      @@da_roachdogjr yeah, but I'm using move_and_slide_with_snap(). It's this an issue with both?

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

      @@backofmyhouse I think what you're looking for is "stop_on_slope" and "floor_max-angle", based on the documentation for KinematicBody:
      move_and_slide_with_snap ( Vector3 linear_velocity, Vector3 snap, Vector3 up_direction=Vector3( 0, 0, 0 ), bool stop_on_slope=false, int max_slides=4, float floor_max_angle=0.785398, bool infinite_inertia=true )

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

    You pro man gdquest world 1st godot teacher
    İm no english

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

    Where did you get that model? That's kind of cool

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

    hi there,
    please help me on script below
    move_direction = move_direction.rotated(Vector3.UP), _spring_arm.rotation.y).normalized()
    is in red highlighted which is not working
    2:52

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

      move_direction = move_direction.rotated(Vector3.UP, _spring_arm.rotation.y).normalized()
      After Vector3.UP you put ) when it is not needed.

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

      ​@@metaj9278 thank you👍🏻

  • @ChaosShroo
    @ChaosShroo Рік тому +2

    As a begginner,
    I have absolutly NO IDEA what any of this means lol

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

      Understandable. As you're learning, you come across plenty of tutorials and videos that only end up teaching you that you're not quite there yet. But that's important info too. So you go one step back to find a starting point that's right for you.

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

    For some reason, when I type var just_landed: = is_on_floor() and _snap_Vector == Vector3.ZERO , it says theres an error