Make your first 3D Platformer in Godot 4: Setup, Movement, and Camera Controls
Vložit
- čas přidán 8. 06. 2024
- 🔗 Code link: gist.github.com/bramreth/d963...
📰 Check out my Godot 4 course sale here! itch.io/s/99395/how-to-make-a...
✨ Socials ✨
🐦 Twitter: / bramreth
💬 Discord: / discord
🥰 Patreon: / bramwell
🎮Games: bramwell.itch.io/
Chapters:
00:00 Introduction and setup
01:24 Creating a 3D scene
03:24 Creating simple shapes
08:52 Graphical Settings
11:20 Supplemental Material
12:16 Creating The Player Character
15:10 Writing a movement script
22:55 Adding input events
25:17 Listening to four input events
27:38 Camera Controls
31:55 Listening to mouse inputs
33:56 Storing mouse motion
38:04 Using the twist_input
40:38 Using the pitch pivot
43:22 Creating node variables
44:55 Handling degrees and radians
45:45 Moving and the camera
47:40 Wrapup
#Godot4 #GodotEngine #Gamedev
It's rare to find a tutorial that really understands just how new its audience members can be. This was really well done, thank you!
Agreed!
agreed
yeah he explains every bit of code and guides us so well so we dont get lost. Wonderful tutorial
agreed!.
Man you're the only person I could find who showed how to make a floor mesh without going through 40+ minutes of video first. Thanks so much.
As a unity refugee this is very useful
As a Godot beginner i approve of this comment
Lol same, just jumped on to Godot.
Same
Same case here
me also...
Someone may have already mentioned this, but Godot 4.1.2 changed Input.set_mouse_mode(Input.MOUSE_MODE_"whatever") to Input.mouse_mode = Input.MOUSE_MODE_"whatever"
for me the old way still works
In 4.2+ "Lock rotation" is under "Deactivation" in RigidBody inspector.
You're doing the lords work
Thank you, I bet people will be coming to this comment for a while
I found this to have a great pace and level of detail for me. Your editing and commentry are also excellent. Thank you.
As a complete noob I have to say this is the best tutorial I have bern through! Please, please do more!
Awesome Introductory guide, helped me start porting a project from Unity over to Godot after the ongoing debacle with that and this really helped me get a hand on the programming workflow for Godot. For other people who just went through this walkthrough you can make diagonal movements more consistent by normalizing the input Vector by adding '.normalized()' to the end of it, this makes your diagonal movements the same speed as your horizontal movements prevent diagonal running by faster. Thanks Bramwell for doing god's work.
Thanks this tip was really useful.
I just want to say, my brain likes the pacing of your tutorial. And you have a dope voice for it.
Props to you for making this.
bro, just unity was an great engine ._.
@@TheWorldofMO :(
I tried learning Unity, then all of the stuff that happened happened, so like I guess Godot was the best choice as I had some level of experience with it on my old computer, but I don't remember a lot so....@@TheWorldofMO
So... we're all here after the BS pulled by Unity the other day huh 😂
Yep, that explains it
Everyone is saying Godot is easier to learn than unity, but it seems a lot more complex to me.. I was just beginning to learn unity and decided to try Godot out as well. Am I the only one who prefers Unity over Godot?
@@thatcardiologist3874 me too, but Unity is not a viable option for most people now
@@thatcardiologist3874there is a difference Godot already has a scripted written. And unity you need to add the #C script your self so it really is which one you know how to use
@@thatcardiologist3874no... I prefer unity because its easy but i quitted unity because latest news
Really good job Bramwell.
Only issues I have are:
If you're using a character mesh that isn't a capsule etc, then you will be able to see that the character does not rotate toward the camera direction as the tutorial stands.
Abstracting the raw numbers to a variable is good code practice, creating a move_speed variable for instance.
Adding a springarm as a parent of the camera (but still a child of the pivots in this case) is also good practice, as it shouldn't allow (or at least make it less likely) that the camera will clip through objects in the game world.
The input direction should be normalized to avoid being able to travel faster than intended in diagonal directions, otherwise the inputs are added together.
As a rigidbody is being used, the actual movements should be handled in _physics_process
how do you make the player rotate with the camera?
@@000-chatGPT basically by rotating just the mesh and not trying to rotate the whole player, I played with it for a long time but rotating the mesh towards movement direction is the only way I can find right now, I'm actually working on my 3d platformer project now so I'll copy and paste some code in a sec
@@000-chatGPT
input_direction = Input.get_vector("left", "right", "forward", "backward")
if input_direction != Vector2.ZERO:
# Calculate movment direction
movement_direction = yaw_pivot.transform.basis * Vector3(input_direction.x, 0, input_direction.y).normalized()
# Rotate mesh toward movement direction
gobot_mesh.rotation.y = lerp_angle(gobot_mesh.rotation.y, atan2(movement_direction.x, movement_direction.z), delta * rotation_speed)
# Move towards input direction
velocity.x = movement_direction.x * move_speed * delta
velocity.z = movement_direction.z * move_speed * delta
else:
# Slide towards previous input if there is no input.
velocity.x = move_toward(velocity.x, 0, move_speed)
velocity.z = move_toward(velocity.z, 0, move_speed)
move_and_slide()
@@scorpi0uk thank you so much i’ll try it now
Dude this is a really well-made tutorial! You explain everything so well and it doesn't feel too fast or too slow.
No disrespect to other helpful creators out there but I've been following loads of godot beginner tutorials, and this guy here is the best by far.
He knows how to teach. He's probably a professional teacher.
Thanks for the great tutorial. I've been doing something similar recenly, so here are some notes:
14:35 Why not use the "capsule" shape directly? It should be more performant in theory.
14:50 I've had an issue (climbing slopes) with this one and opted to instead lock all 3 angular axis, maybe it will help someone.
17:05 Isn't it better to just call them "built-in functions"? In terms of "virtuality", you can override the user-defined ones as well.
19:50 It is potentially bad to apply physics-related interventions from the "_process" callback. You could switch some internal state from "_process" and then apply force in "_physics_process". Or just set the "constant_force" from "_process", so that the physics thread can apply it when it pleases.
thanku :D for the slopes issue!!!
callbacks
Just started the video and already I have to say I'm liking your style of explaining things in a concise, yet detailed manner. Seems to be very thorough while being easy to follow for a beginner.👍
Awesome tutorial! Easy to follow. The depth of explanation was just right. I’ll be checking out your other stuff for sure.
the way he explains every bit of code and guides us so well so we dont get lost. Wonderful tutorial and one of the best out there
Thank you for taking the time to make this, it has been extremely helpful
Hey man, thanks for this amazing tutorial. I've been an 3D Animator my whole career but for my free time I finally want to get into creating a few of my own games, of course a bit smaller in scale.
It was really easy to follow along and you always came back and explained the code we were writing which is super important for me. (I followed other tutorials before and I always kind of accepted "guess this is how it works and I am just not smart enough to get it.") I never coded before, have been severly convinced I am bad at math und it seemed like dark magic but now I look at this little pill with 3D camera and feel proud and smart. :)
Will definitly check out your other courses. Cheers!
dude this is feckin amazing. i have learned a lot from this, already expanding my knowledge on godot... added sprinting and jumping. chance i may have found doing so easier being a unity dev for 10 years but this has helped me learn this engine
edit: fov broke, don't know what i did
Honestly one of the best tutorials I've seen. Really clear and well paced. Also the editing is clean and really helps to understand what's going on. Please keep them coming, definitely going to purchase your course once I've got the hang of this!
Thank you!
Came here after the Unity install-fee debacle. This is an excellent introduction to Godot for someone coming from Unity. Thanks a lot :)
i love seeing greed get punished, delicious tears of the people who pushed this idea. was it the board or ceo idk, but whoever it was must be shitting their pants now lol
same, you trying out different alternatives other than godot too?
I am loving it so far. Unity is toast.
@@sourlesscream1272 I've dabbled with Unreal over the weekend as well. Right now I feel:
- Unreal is a superpowerfull piece of software, but has 'it's way of doing things' (I have an existing charactermodel and animationrig, and haven't been able to get it to work as of yet)
It also has a whopping 36 gig install size, and my pc doens't run it super smoothly..
- Godot is super lightweight, but with a lot less functionality. (for 3D games at least)
With this streamlining comes more of a 'you figure out your own way of doing things' kinda approach, which I appreciate. With help of this wonderful video I could make a simple 3D platformer with an animated character in a couple of hours :)
Also my pc runs Godot a lot better than Unreal.
It's also open source and a non-profit organisation, which in todays technofeudalistic economy gives them 100 bonuspoints in my book :)
So yeah, I'm currently leaning towards Godot. How have you been getting a long?
Everyone is saying Godot is easier to learn than unity, but it seems a lot more complex to me.. I was just beginning to learn unity and decided to try Godot out as well. Am I the only one who prefers Unity over Godot?
At 45:30, instead of using deg_to_rad(), you can actually reference the degrees directly: "pitch_pivot.rotation_degrees.x". So you don't need to convert the clamped values to radians.
For me, it locks the pitch of the camera
@@lemmings1892 Here's the code I have:
camera_mount.rotation_degrees.x = clamp( camera_mount.rotation_degrees.x, -45, 45)
But take it with a grain of salt, I'm just a newb. It works for me and I did make some changes from the tutorial, I wanted more of a shooter-esque control scheme.
This is very solid. I really appreciated the zooming and screen animations to highlight what you are doing
Wonderful tutorial! I'm very new to game development and I was finding myself becoming very discouraged after attempting a few other tutorials and getting super overwhelmed. This one was easy to follow along with, and I really appreciate how you explain in so much detail, rather than just giving us steps to copy. Will definitely be checking out the course.
Amazing video man. Loved the amount of detail you included and your clear instructions.
This is so well explained, woah! I like how you explain everything in detail its super helpful
This was a fantastic tutorial! The pacing was perfect for easy following and everything worked as advertised. It's just what I needed to finally get a start on my project and will provide a great foundation to build up from.
Thanks!
please continue this series! i bet many will love this like me!
this is a godsend. so glad to see high quality tutorials for godot :)
Please continue with these videos. Very well done,. Well paced and clearly explained without going in to too much detail straight from the get go. Perfect for me. Thanks a lot.
a beautiful and perfectly done tutorial. Everything is explained clearly, and very easy to follow. Thank you so much!
incredible tutorial! Please continue making them! 🥺
Excellent work. Very well done, and will purchase the course. Please continue the video series too!
My god, finally someone who told me how to do the mesh on the ground!! I was dying trying to figure it out. Subbed and liked, best tutorial by far.
thank you so much man this really helped me its rare to find someone who actually explains how everything works
The way you paced this video, and the contents, is pure gold...⭐⭐⭐⭐⭐
Amazing tutorial. Information dense, yet easy to follow.
Really appreciate the tutorial! I was feeling reaaally intimidated by learning gdscript and getting into godot in general as a beginner in game development and this made it feel so much better!
This was exceptionally well put together. One of the clearest and most helpful tutorials I've ever watched in general. I've worked in GameMaker for years now, but am considering how feasible it'd be to work in 3D in Godot in the future. Even though I didn't "follow along" with the engine open, I now have a really good sense for how Godot operates and it's actually pretty damn exciting. Definitely keen to give it a proper go now and see what I can russle up through prototyping at some point!
same! Worked in gamemaker since overmars released it, way back in the stone age - totally agree with you on his presentation. It's gotten me back into it for sure
I am currently working on a 3D-world grid-less turn-based RPG and this tutorial has been incredibly helpful in setting up the basis of what I am working towards. Thank you so much for this tutorial, you have no idea how helpful it has been!
Thank you man. Very hard to find a tutorial that is easy to follow
You explain it so well! I've been following you on my Godot!
Thank you!
This is far and away the best guide I have found. I look forward to learning more from you.
This is a fantastic tutorial, have learned a ton about Godot, and inspired on various approaches to improve my own tutorials. Great stuff!
You Don't Know How Much This Helped Me!
Amazing tutorial, thank you!!
That was clean and concise. I really learned some basic things I should have known a long time ago. This helped me get over the "this doesn't work, now everything sucks and this shouldn't be this complicated" bump
This is super easy to follow and super helpful as well
Thanks a lot my man
jesus this is SO MUCH better than a lot of other godot tutorials, especially a lot of those weirdly high production value ones that YT pushes to the top of search results but are outdated and unclear. thank you so much for making this!
honestly I love your tutorials super easy to follow;
thank you very much :)
I really appreciate how slow and steady this tutorial is. Exactly what I needed. Cheers to Day#2 of learning game dev !!
Me to
Simply perfect. Right speed for a beginner, well explained. Subscribed.
What an utter gem of a channel. My game dev skills are so rusty they may as well be non-existent at this point. This was a fantastic and succinct tutorial to get anyone up and running fast. I learned some new tricks too!
This vid is edited uniquely superb. Thank you!!
Really nice tutorial! Thank you for such a useful introduction to godot 4
This tutorial is perfect, both for beginners and regulars. Thank you🙏
thank you very much for this video, this is the exact kind of camera style i want for my game, and even if i did find one like this before, all were outdated, so thank you
this is really really well done! and Ive watched / read alot of tutorials. thank you! I can finally make my blob wander through my wonderful 3d assets :-)
Great video, very comprehensible, great pacing, and great explanations.
Unironically one of the best game dev tutorials ever. Other channels should take notes! 👍👍👍
thank you so much for linking the code in the description so we dont have to meticulously type out every character, it helps alot
Amazing Video and straight to the point while ensuring everyone is following along. these are really that style of videos that i need. thank you so much. Only really introducing the things when they are relevant and giving a brief but yet detailed explanation on the things.
Fantastic Tutorial! Great Work!
Great tutorial! Looking at buying your course!
Thank you for the awesome tutorial! Godot is underappreciated.
This was the best getting started video for godot I have seen!
Amazing tutorial. I cannot describe how helpful and thorough this is. Thank you, sincerely.
Great tutorial - well done!
Exceptional Video and Brilliant commentary. Thank you for all the help!
Very well put together video. Thank you
This is an amazingly instructive video, thank you for making it.
You speak really well and your teaching method is very effective. Thanks for the video, I'll be following you! Another subscriber.
one of if not the best intro tutorial i've experienced god damn
Great tutorial! I'd love to see more videos like this on Godot.
incredibly concise and calm
Dude, this is the best Godot 4 Tutorial I've found so far.
Thank you very much !
Thanks a lot for the tutorial. Just what I needed.
best beginner tutorial ever, thank you!
Thank you for the course. A very detailed explanation. Bought it
Thankyou so much for the support!
Same, world class Godot course and tutorials - please keep up the amazing work!
Nice one! Thanks for this.
22:49 I felt so bad when he flew away 😭
Yeah this is a really excellent tutorial. Like a few other commentors, I'm a Unity refugee and I super prefer this level of deep explanation about even the most simple concepts, it's so helpful to properly understand the tools.
Thanks!
(Also saw a semi recent 4 dev Game Jam of yours, kicked ass)
Great video, really clear and concise.
Best starter 3D Godot tutorial I've seen yet. Thank you. I'll be buying the last sections too.
Some feedback:
In the code writing segments:
The slow detailed explanations was really good in most of the tutorial, except for in the code writing segments without lots of pausing and rewinding.
Please use one set way of writing the code and explaining - with steps - and tell us that this is how you will be explaining the writing of code at the start of the video, so it's a process to follow for learners each time a code writing segment comes up.
E.g. Brief overview of what the code is for, before-while the video shows it being typed. -> PAUSE (showing all of the newly written code) to let people copy it and take it in (pausing a couple of times could even be helpful) -> Then go over the different parts in detail.
I understand you can spam pause and rewind as much as you like, but sometimes there was just too much going on at the same time, descriptions and new code being added, with a cut to a new scene without time to process what's going on.
Why in this order?
When I've been doing these tutorials it has helped me learn to hear a brief overview -> copy the code myself, because when you're writing it yourself it forces your brain to figure out which parts are doing what and where the values for the variables are coming from, etc. Then the actual proper explanation of what's going on tells you if you're right or wrong.
Writing the code as a newcomer is also the most stressful part of learning game engines.
Making it more orderly also allows time for taking notes, as in the segments I was always back and forth over one sentence.
Thx again. :)
This helped so much, thanks!
Thank you so much !! It was very helpful!!!
So glad to see a rigidbody controller tutorial rather than kinematic. Excellent material, thank you!
thank you so much, this is a great tutorial for absolute beginners in godot
Your voice is relaxing and you're great at teaching. Keep it up!
just a great Tutorial you did there, that was not my first time of godot. But at the first Time i wasnt doing it properly so now i wanted to make a basic Project. Thanks again for that great Tutorial
Thank you for this great tutorial!
10/10 tutorial for beginners, absolutely perfect for me as someone who has never used game engines or even done basic coding
Thank you, very in depth with resources
Thank you so much for making this video 🙏🙏🙏
Awesome work thank you!
Nice and chill, conductive to learning.
amazing video, you really got a knack for this
thanks man you have great tempo and a very pleasant voice
adding comment half way through this is definitely very in-depth which is the kind of tutorial I like best especially if you using a program for the first time