FPS Character Controller in Godot - Make an FPS in Godot Part 1

  Рет қаралды 164,170

Code with Tom

Code with Tom

Күн бұрын

In this video I will show you how to make an FPS character controller in Godot.
Source Code: github.com/codewithtom/godot-...
This video covers setting up your player object, complete with head, camera and collision capsule. Then it will show you how to implement an FPS character controller to allow the player to use the keyboard and mouse to move around a 3D scene. We will cover speed, acceleration, gravity, jumping and some sneaky gotchas.
In this series of FPS Godot tutorials I will teach you how to make your very own FPS in Godot. Subscribe to stay up to date!
Music By: LAKEY INSPIRED @ / lakeyinspired

Пікірлер: 534
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Just to let you know there's a technical issue with the www version of the website right now, but you should still be able to access it at codewithtom.com. Apologies for the inconvenience and thanks!
@cwasunt9468
@cwasunt9468 4 жыл бұрын
Tom please help!!!!! At around the 17:00 mark my player only moves right! What could I have done wrong?
@cwasunt9468
@cwasunt9468 4 жыл бұрын
Nvm I figured it out
@gregorycandiotes4293
@gregorycandiotes4293 4 жыл бұрын
Myne says unxpexted error if pls help
@sirechubs
@sirechubs 4 жыл бұрын
My player keeps moving right, how do I fix that?
@sirechubs
@sirechubs 4 жыл бұрын
@@cwasunt9468 how'd you do it?
@user-wy7oh6tg1e
@user-wy7oh6tg1e 4 жыл бұрын
Godot doesnt have many videos on youtube, so I really like that he started to upload videos
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you! :)
@jackv7614
@jackv7614 3 жыл бұрын
7:25 THANK YOU! Making the text bigger is so simple that makes following along so much easier and yet it's something so many people overlook
@johnnygossdev
@johnnygossdev 5 жыл бұрын
I've always thought 3D was a little beyond me a tthe minute but I dare say Tom, you are convincing me otherwise! Great tutorial thanks so much!
@CodeWithTom
@CodeWithTom 5 жыл бұрын
If you can make a game in 2D you can make one in 3D. Give it a shot, I think you'll surprise yourself!
@dubsidian6975
@dubsidian6975 4 жыл бұрын
Thank you for taking the time at the end of the video to go through almost line by line and recap what the code does and how it affects the project, a lot more presenters could benefit from this, it's very helpful to a novice of programming. Great tutorial, easily one of the best I've seen on KZbin, especially for Godot.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you for the kind words, I really appreciate it
@leeramer171
@leeramer171 3 жыл бұрын
@@CodeWithTom I 100% agree, I like your summary on everything you have taught during the tutorial. Everything is very well explained, pace is excellent, very much appreciated.
@CodeWithTom
@CodeWithTom 3 жыл бұрын
@@leeramer171 thank you Lee I really appreciate it 😁
@sykoo
@sykoo 5 жыл бұрын
This is fantastic man! Keep up the great work on these videos. =)
@CodeWithTom
@CodeWithTom 5 жыл бұрын
Thank you so much man! I've been a huge fan of your channel for a long time now so that means a massive amount!
@romanglinnik8073
@romanglinnik8073 4 жыл бұрын
Hey Sykoo
@shwetanksingh2156
@shwetanksingh2156 3 жыл бұрын
What are you doing here ????
@mezzowatt
@mezzowatt 4 жыл бұрын
This is the first Godot video which I actually understand - I didn't need to replay anything to understand what was going on, not to mention the fact that you started on a blank project instead of using a premade one. Thanks a lot!
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you for the great feedback. I'm really glad you were able to follow along! :)
@torresmodernidad1262
@torresmodernidad1262 4 жыл бұрын
I was looking for a quick way to understand how the godot engine works by looking at someone code something simple and wow i just loved it! Thanks explaining everything so clearly and easy to understand. Keep it up!
@mna226
@mna226 4 жыл бұрын
Thank you, this was very well explained. I was going through FPS character control in Godot documentation, but was not clear on many things. The way you added functionality step by step, explaining at every point what additional lines of code were doing, made it so much easier for me to understand.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
You're welcome Muhammad, glad you enjoyed it and found it easy to understand :)
@youngsplasher7990
@youngsplasher7990 3 жыл бұрын
Why did everything he explained made sense to me first time. Usually, tutorial videos like this does not make sense to me and I have to re watch to understand. I respect your short on point explanations. No stretching out here.
@thomaseubank1503
@thomaseubank1503 3 жыл бұрын
Thanks for the video, got it all down. My only mistake was typing action_just_pressed instead of action_pressed. All in all I really like the pace. You do not go so fast that I have to rewind constantly like other youtuber's tutorials.
@tsk5328
@tsk5328 2 жыл бұрын
hi total novice here but I use the youtube video speed functions for those videos where the passing is to fast or (very rearly) to slow. After I saw a friend doing it I started using the speed options and its been a huge help for me, so just passing the trick on :-)
@solidsnakefovever
@solidsnakefovever 3 жыл бұрын
I took one cs class in college and I was able to follow your tutorial! I appreciate you talking through your logic so I can more or less understand how the code works.
@Connor3G
@Connor3G 4 жыл бұрын
Thanks for this tutorial. Currently my favorite Godot tutorial I've found so far.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
That's so great to hear! Thank you
@jowilson5581
@jowilson5581 4 жыл бұрын
Thank you! This is easily the most concise, simple, well-coded and easy to follow video of this type I've found on KZbin. Thank you, thank you, thank you.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you for the amazing feedback, glad you enjoyed the content 😁
@flow_jbozz
@flow_jbozz 2 жыл бұрын
this has been the best tutorial ive come across so far. straight to the point, easy to follow and well explained. thank you
@mobinalimohammadi3519
@mobinalimohammadi3519 4 жыл бұрын
Absolutely brilliant Tom! It's one of the best and easiest tutorials I've seen! Thanks a lot, mate.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you Mobin, glad you found it useful.
@solomonsilbert-enright1270
@solomonsilbert-enright1270 2 жыл бұрын
thank you so much for this tutorial. I was having a really hard time figuring out godot and this helped a ton. super simple instruction, straight to the point and very easy to understand
@TheMaxthesis
@TheMaxthesis 4 жыл бұрын
Great video, love the pace and no nonsense to the point.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you I really appreciate it
@puppypie.
@puppypie. 4 жыл бұрын
This tutorial uses the most suitable standard API than I saw in other tutorials, which use a lot of non-standard unnecessary mathematical operations (I would say hacks, for example lerp function on both axis for smooth moving and so on), thanks! P.S. You can use clamp() function to set min and max viewing angle.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you Denis I appreciate the feedback! (Good shout on the clamp function)
@emporioxorton
@emporioxorton 3 жыл бұрын
Amazing!, by far the best Godot FPS tutorial on KZbin. Thank you so much! Keep up the great work.
@guyinplaid3472
@guyinplaid3472 2 жыл бұрын
My man this is an incredible tutorial. I was actually able to create what you did and everything! 10/10 Can't wait to check out your other tutorials
@jaimerojas6578
@jaimerojas6578 3 жыл бұрын
Awesome Tom really liked this series of tutorials!
@garrettk7129
@garrettk7129 3 жыл бұрын
the only game dev tutorial channel whos code actually works for me, thank you!!!
@madebyLGrabowski
@madebyLGrabowski 3 жыл бұрын
Great tutorial! Thanks so much, I've subscribed and am going to be taking a look through the rest of your channel.
@Brewski66627
@Brewski66627 2 жыл бұрын
just started coding with godot and much thanks for this tutorial :) helping me understand it alot better, will continue and let u know how i get on hehe
@booooooooooooooooooooooooo
@booooooooooooooooooooooooo 2 жыл бұрын
Thank you soo much bro . I just started learning godot. This really helped me. Keep uploading. You re awesomme !!!!!💥💥💥
@s0ur31
@s0ur31 3 жыл бұрын
Very Helpful Tutorial......Thanks for making the FPS series
@leroyjenkins614
@leroyjenkins614 4 жыл бұрын
this is really good! you ecplained what the code really does and that makes it easy for beginners! you also did an overview of the code at the end which further explains the code
@golammostofa31188
@golammostofa31188 4 жыл бұрын
Thank you very much for uploading this videos. this inspired and helped me to learning Godot
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Hey Golam, you're most welcome!
@mallimuondu6779
@mallimuondu6779 3 жыл бұрын
i am so happy most of the Godot projects I do they fail but this worked congrats :)
@t3st3d
@t3st3d Жыл бұрын
this is the best godot tutorial i have seen.
@BluzBazz
@BluzBazz 3 жыл бұрын
Outstanding tutorial! Liked and subscribed.
@joliecat5463
@joliecat5463 4 жыл бұрын
Thank you, fantastic explained, everything traceable, thumbs up
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thanks Jolie, glad you found it useful!
@ZakRahman
@ZakRahman 3 жыл бұрын
Absolutely fantastic video. Great explanations. Thank you!
@alistair_mcintyre
@alistair_mcintyre 4 жыл бұрын
This is an incredible tutorial. I am just getting into Godot and this is one of the best tutorials I have seen yet. Way too many people assume previous programming knowledge, you explain it very well. I have a game idea that I want to see through as a hobby project. Will certainly be catching up on the rest of your videos.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you so much! I wish you lots of success on your project!
@carolbaskinss2373
@carolbaskinss2373 3 жыл бұрын
Great followable tutorial. I feel like I can now win game of the year
@halleyqueen4807
@halleyqueen4807 2 жыл бұрын
I really appreciate your help!
@amirghalbarband3038
@amirghalbarband3038 2 жыл бұрын
That was great man, thanks a lot bro
@fernandogramirez1
@fernandogramirez1 2 жыл бұрын
thanks for this amazing tutorial! Done!
@greatvaluehokage139
@greatvaluehokage139 3 жыл бұрын
Your awesome man keep up the good work 👍
@conspiracyman5031
@conspiracyman5031 3 жыл бұрын
Thanks a lot, I enjoy your tutorials
@butanddingj4393
@butanddingj4393 3 жыл бұрын
this was so easy to follow, thank you so much!
@YermakTheMapper
@YermakTheMapper 4 жыл бұрын
Very nice and informative tutorial! Thank you!
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Cheers Yermak glad you liked it!
@wolfsoldier0875
@wolfsoldier0875 3 жыл бұрын
You need more subs. Your great
@shire7949
@shire7949 4 жыл бұрын
This is great! Thank you.
@321357w
@321357w 4 жыл бұрын
very well presented and explained, looking forward to more.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Cheers Jeff really appreciate that. Hope you find the 2nd and 3rd parts useful too
@321357w
@321357w 4 жыл бұрын
@@CodeWithTom Hi Tom, I just noticed as I am using Godot 3.1 that I have this error code ( The argument 'delta' is never used in the function '_process'. ), is this something with 3.1 as the player will no longer move and I am unsure where things are amiss. Thanks for your reply.
@duckgaming94
@duckgaming94 2 жыл бұрын
@@CodeWithTom for some reason i can only move right can you plz help me
@waywardpooch9567
@waywardpooch9567 4 жыл бұрын
Thank you very much for posting! Subscribed.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you, I'm glad you liked this video.
@eod696
@eod696 4 жыл бұрын
This was an excellently presented example Tom, however I have one gripe. I added a crosshair to the UI control node, dead center of the screen, and found that small movements with my mouse were not registering as I expected them too. After hunting down a couple of other FPS tuts on Godot, I saw a key difference between those examples and yours - the camera movement occurs in the `_physics_process` listener rather than the `_input` listener. When I moved the camera movement into the physics process and accounted for the time-delta to make the movement FPS independent, I had to raise the mouse_sensitivity to 10, but after that, it worked precisely as I expected it to.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Good spot! Thanks for sharing 😁
@eod696
@eod696 4 жыл бұрын
@@CodeWithTom Welcome! Thanks for the intro to 3D. Like I say, it was excellently presented. Also, you gave insight into the library where others did not, and a person with development experience, like myself, will truly appreciate that. Cheers!
@arkumar842
@arkumar842 3 жыл бұрын
This is soooo great!
@Kura.tf2
@Kura.tf2 3 жыл бұрын
THIS VIDEO MADE ME SUBSCRIBE THANKS SO MUCH, and also this is Larry 🐺 he will protect you
@3rdpoly
@3rdpoly 4 жыл бұрын
The man says the name correct - you have earned your like from me - keep it up 💪🏻
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Haha, thanks!
@TheRealKaiProton
@TheRealKaiProton 3 жыл бұрын
That was great, Watched this pt1 yesterday to get a feel for it, and just gone over it again following along in godot, nice clean code, allowed me to add a double jump, and disable to controls in the game with the mouse capture parts, something that I dont understand, is on the Clamping of the head angle, why not user the clamp function in the engine?
@vikkytg7230
@vikkytg7230 3 жыл бұрын
and wat is wrong with youtube ur channel is so underrated
@eldelnacho
@eldelnacho 4 жыл бұрын
Thank you very much! Very helpful videos!
@CodeWithTom
@CodeWithTom 4 жыл бұрын
You're very welcome!
@jummairufai8892
@jummairufai8892 3 жыл бұрын
love ur work
@Xx_Eric_was_Here_xX
@Xx_Eric_was_Here_xX 2 жыл бұрын
If you're having issues spawning the bullet: make sure the Player, Sprite, CollisionShape2D all have their centers aligned aligned! Player's elements can be at the bottom of the screen like in the video, but the Bullet should have everything aligned in the center (0,0)! I had to adjust the position offset a little bit, so my vector ended with position.y - 30 instead of 20, to avoid the Player getting nudged off screen with each bullet spawn. hope this helps someone. also, you can use print(......) to get an idea of what a line of script is doing, it will print it into the console. neat way to learn and find out what you're doing wrong
@skaruts
@skaruts 4 жыл бұрын
Getting the basis from the _camera_ instead of the _head_ seems to do half the job of turning your controller into a fly camera, which can be quite useful for debugging (and cheating).
@X_Daniel466
@X_Daniel466 4 жыл бұрын
Cool. Thanks for videos. Godot is actually good never really gave it a try.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you. Its a great engine for sure. I hope we see more people adopt it in the future.
@KellenChase
@KellenChase 4 жыл бұрын
great. thanks for sharing. following along.
@lifegiver2048
@lifegiver2048 2 жыл бұрын
Hey tom, love the video, i was curious on what to do if I want to add a double jump into the game?
@zzador
@zzador 4 жыл бұрын
Can not say less than "excellent tutorial". You may want to add as a side note that not normalizing the direction vector would result in the famous strafe running bug/feature which was present in the game "Doom" from 1993.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you and very good point!
@the-voidwalker
@the-voidwalker 3 жыл бұрын
ty man i sub and liked on chanel you rly helped a lot with this
@yari3061
@yari3061 2 жыл бұрын
THANKS YOU SO MUCH, MAN
@mldsh
@mldsh 4 жыл бұрын
Thank you man, you helped me a lot
@CodeWithTom
@CodeWithTom 4 жыл бұрын
You're very welcome!
@atharvvbhandare
@atharvvbhandare 3 жыл бұрын
6 thousandth subscriber awesome sir thanks alot
@LordMannu
@LordMannu 3 жыл бұрын
Awesome tutorial. I just complete it and everything works fantastic. Just one thing I would like to add and I can´t figure it out. How could I make the palyer run while pressing shift? Thanks!
@andresochoa5979
@andresochoa5979 2 жыл бұрын
Love it!
@aldindelic6488
@aldindelic6488 3 жыл бұрын
Wow! Bravo sir!
@rambosweat
@rambosweat 3 жыл бұрын
you can also use the $Head object's rotation_degrees.x instead of rotate_x() which forces you to mess with deg2rad(), instead of just using degrees directly. not sure if this is a 3.2.3 specific feature though...
@jshi3
@jshi3 3 жыл бұрын
10/10 extremely helpful
@Devprecious
@Devprecious 4 жыл бұрын
Thanks alot mr tom
@nuralimedeu
@nuralimedeu 4 жыл бұрын
I wrote my script to be exactly like yours, but for some reason when I start the game my player always falls through the ground into the void. Can you explain this, please? Edit 1: It turned out my player fell through because I couldn't make the collision shape work without a static body attached to the ground. Thank you for this wonderful tutorial!
@ghostriley22
@ghostriley22 4 жыл бұрын
For quick prototype, you can use csg mesh where you have to just enable a checkbox for collision.
@nuralimedeu
@nuralimedeu 4 жыл бұрын
@@ghostriley22 How do you do this?
@ghostriley22
@ghostriley22 4 жыл бұрын
@@nuralimedeu when you add child node(Ctrl+A) search for CSG, there you will get csg cube, sphere , capsule similar to the ones in mesh instance. You will find Enable Collision tickbox in property panel
@nuralimedeu
@nuralimedeu 4 жыл бұрын
@@ghostriley22 Thank you.
@daorigingamer5359
@daorigingamer5359 4 жыл бұрын
Hey Tom, amazing tutorial so far, but i cant seem to run the project. I get an error every time saying Failed to build project solution
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Hey thanks for the feedback! That's strange, do you get any more error messages? If you are able to join the discord and share your project files with me I would be happy to take a look
@BrianRogers3D
@BrianRogers3D 4 жыл бұрын
Well done Tom! Very clear and to the point. Quick question: Why did you put the movement on the Head node instead of the Player node? Wouldn't that just move the head without the body? regardless, thanks so much for this video and the other FPS tutorials you've made.
@dArtistGames
@dArtistGames 4 жыл бұрын
He didn't. He used the head's basis value to find direction. movement is applied from the velocity variable and on the Player node.
@demonmusic8117
@demonmusic8117 4 жыл бұрын
600th subscriber!!
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you! 😁
@chaoskid1024
@chaoskid1024 2 жыл бұрын
27:50 F5 and F8 start and stop debugging respectively. So if you don't want to bind a key to unlock the cursor, you can just hit F8 to close the window.
@RaiderJake
@RaiderJake 4 жыл бұрын
Is there a way to keep the mouse on the screen and never disappear? if i die without the mouse on the screen, the mouse doesn't appear on the continue screen. Or maybe a way to use the keyboard for the menu's?
@haroldmcbroom7807
@haroldmcbroom7807 4 жыл бұрын
How would you implement a main menu with custom image backdrop such as a planet, perhaps with moving images, and highlighted text affects along with sound on mouse hover, click, and exit events?
@CodeWithTom
@CodeWithTom 4 жыл бұрын
I'll add this to my list of things to cover :D
@thegoldenglade623
@thegoldenglade623 4 жыл бұрын
Great tutorial dude! quick question, i was trying to make a 3rd person camera using the tutorial and when i got to the last camera bit i could only look up and it Just keeps looking up until it looks back at the bottom of the model and then resumes its madness any way you know to fix this?
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Hi, if you are able to, I'd suggest joining the discord. That way you can share your code sample with me and I'll be able to help you easier :)
@laurentkadeko53
@laurentkadeko53 4 жыл бұрын
hello really good tutorial but I have a problem it says for me at line 35 that direction isn't declared in the current scope and I have followed and understood but I don¨t know what to do
@OmegaF77
@OmegaF77 4 жыл бұрын
I think the better way to clamp the x rotation of the camera is by using the clamp function: var cam_x_rot = 0 func _input(event): if (event is InputEventMouseMotion): head.rotate_y(deg2rad(-event.relative.x * mouse_sens)) cam_x_rot += event.relative.y * mouse_sens cam_x_rot = clamp(cam_x_rot, -90, 90) camera.set_rotation_degrees(Vector3(-cam_x_rot, 0, 0))
@Raphipod
@Raphipod 4 жыл бұрын
worked right away! this also fixed the problem getting the head/camera stuck while looking down to the ground.
@tanguydespat8714
@tanguydespat8714 4 жыл бұрын
Nice, thank you
@CodeWithTom
@CodeWithTom 4 жыл бұрын
You're very welcome!
@boomerboyzr9612
@boomerboyzr9612 3 жыл бұрын
Any idea how instead of using a keyboard and mouse I can use a game controller? ik how to map the movement to the controller, but I don't know how to change the camera rotation
@johnnythin7586
@johnnythin7586 3 жыл бұрын
I have a problem. I fall through the floor when I have gravity on so I think it’s something to do with how the player collides with the collision shape
@italiatroller4793
@italiatroller4793 2 ай бұрын
tried to replicate this using visual script and worked :)
@skaruts
@skaruts 4 жыл бұрын
One thing you didn't address here (I don't know yet if you addressed it later), is that *velocity.y* is being reset every frame when you interpolated the vector, and so gravity isn't being accumulated and the player falls like it's on an elevator. I played around with two solutions: *1-* Store *velocity.y* in a throwaway variable right before interpolating the velocity, and then set *velocity.y* to it and apply gravity as normal. Basically this: *var y_speed = velocity.y* *velocity = velocity.linear_interpolate(direction * speed, acceleration * delta)* *velocity.y = y_speed* *velocity.y -= gravity* *2-* Interpolate only the *x* and *z* components of *velocity* with the *lerp()* function. Like this: *velocity.x = lerp(velocity.x, direction.x*speed, acceleration * delta)* *velocity.z = lerp(velocity.z, direction.z*speed, acceleration * delta)* *velocity.y -= gravity*
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Very good point. For most cases this is ok, but if you're wanting a more realistic gravity effect then your solutions might be a good idea!
@comnrade
@comnrade 2 жыл бұрын
Invalid get index 'relative' (in base: 'InputEventKey'). Can someone help me? when I start the game from the menu it works normally, but the console detects this bug, and when I have run by F5, it just closes by itself after I press any movement key
@dtaechoes7473
@dtaechoes7473 2 жыл бұрын
Great video! I have one more question. How could I make a sliding mechanic in Godot? I was trying to implement one into my game, and am stuck. Thanks!
@birdoflames329
@birdoflames329 2 жыл бұрын
there is a tutroial by garbaj about that
@dtaechoes7473
@dtaechoes7473 2 жыл бұрын
@@birdoflames329 can you put the link or the name of the video here please? I was looking through his channel and have found nothing about it. Thanks
@artemiogaming22vods98
@artemiogaming22vods98 4 жыл бұрын
thank you very much!!
@CodeWithTom
@CodeWithTom 4 жыл бұрын
You're very welcome!
@bussin1337
@bussin1337 4 жыл бұрын
Great series overall but i have a suggestion on how to handle limiting the player to rotate far beyond 90 degrees, this is what you can do instead of having a global variable: # Rotate the whole player instead of just the head. self.rotate_y(deg2rad(-event.relative.x * mouse_sensitivity)); camera.rotate_x(deg2rad(-event.relative.y * mouse_sensitivity)); # We can make use of the rotation_degrees property and the method clamp var cam_rotation = camera.rotation_degrees; cam_rotation.x = clamp(cam_rotation.x, -90, 90); camera.rotation_degrees = cam_rotation;
@shire7949
@shire7949 4 жыл бұрын
Thanks!
@pierrenagonio
@pierrenagonio 4 жыл бұрын
Thank you. BTW do U know how to limit left and right sides? Not only up and down?
@bussin1337
@bussin1337 4 жыл бұрын
@@pierrenagonio Try this but it has an issue with it, it won't let you go far left at all even after you move there. I do have an idea on how to make it work though. Let me know if you would like to know. This is the code that isnt fully working: # Rotate the whole player instead of just the head. self.rotate_y(deg2rad(-event.relative.x * mouse_sensitivity)); camera.rotate_x(deg2rad(-event.relative.y * mouse_sensitivity)); # We can make use of the rotation_degrees property and the method clamp var cam_rotation = camera.rotation_degrees; cam_rotation.x = clamp(cam_rotation.x, -90, 90); camera.rotation_degrees = cam_rotation; # Limit player body y axis rotation var self_rotation = self.rotation_degrees; self_rotation.y = clamp(self_rotation.y, -90, 90); self.rotation_degrees = self_rotation;
@bussin1337
@bussin1337 4 жыл бұрын
​@@pierrenagonio I just uploaded this code here, it limits left and right side and it will rotate body to where camera is facing when you move forward. Note that I changed the Player scene's structure. Code and new scene structure here: gist.github.com/ShRyDeR/5db7e72775c4749ffea38ccf159552a2
@pierrenagonio
@pierrenagonio 4 жыл бұрын
@@bussin1337 amazing! Thank you very much for this work. I have took one part from your code and luckly is working with my game. Thank you one more time for your time and for sharing your knowledge. I wish I have you in my halp godo desk but I don't want to waste your time. Peace.
@Mrpaul20
@Mrpaul20 4 жыл бұрын
Thank you sir U r amazing
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Most welcome!
@nimmen
@nimmen 3 жыл бұрын
If you treat the ingame units as meters, and size the character and all your game objects accordingly, the variables like speed and acceleration will be in m/s and m/s^2 Currently I have the first person collider at 1.80m tall and 0.50m wide (radius 0.25) and the camera height at 1.65m, which would be eye height. Rotating the camera up and down goes around a RotationHelper (your Head) node, like in the official tutorial, which I have placed 0.15m lower than the camera, at 1.50 m. I think this makes the up and down movement more realistic looking, as you would pivot your head at your neck, not your eyeballs.
@panskibinski
@panskibinski 3 жыл бұрын
5:47 When I create collision sibling this way (not by convex static body) the player falling does not stop when he hits ground (25:50) is this correct?
@foxvlogsandm0re408
@foxvlogsandm0re408 4 жыл бұрын
I loved the tutorial but I'm using the Godot 3.2.2 and I'm not sure what happend but it told me that an error occurd and my elif statement for the forward and backard if statement was misplaced here are my code lines for reference. if Input.is_action_pressed("move_forward"): direction -= head_basis.z elif Input.is_action_pressed("move_backward"): direction += head_basis.z
@coltonosborne4474
@coltonosborne4474 3 жыл бұрын
Hello everyone. I was having an issue where my player was falling through the floor. Im not sure if this is due to an update or something. My kinematic body would not detect the collision with the floor, because godot didnt like having a collision shape attached to spaitial or mesh instance. I added a static body inbetween the spaitial and the mesh instance and that fixed the issue
@birdoflames329
@birdoflames329 2 жыл бұрын
i had the same problem and didnt manage to fix it, even with adding a static body between the spacial and the mesh instance
@insidiousgamer6120
@insidiousgamer6120 4 жыл бұрын
Tom what should i do? When i type this script camera.rotate_x(deg2rad(-event.relative.y * mouse_sensitivity)) when i launch the game i does not work plsss help me!!!😫😫😫😫😫
@youngsplasher7990
@youngsplasher7990 3 жыл бұрын
Why did you use Camera node for Y mouse movement and Head node for X mouse movement? Shouldn't they use same node?
@nyle7329
@nyle7329 2 жыл бұрын
Hi! I was following this tutorial but whenever I attempt to move my capsule in the scene player I can only move it with the d key pressed, so if i want to move back, I will click d + s while if I want to move forward I would click d + w, now this is obviously a problem as I cannot move left, forward or back normally. Is there any solution?
@ricardoalves3109
@ricardoalves3109 2 жыл бұрын
I messed something up in the beginning. Not sure what. But for some reason the ground only appears if i press "play edited scene" instead of the normal "play this project" Just wanted to fix it in case it causes problems later. Would really appreciate some help please.
@duckgaming94
@duckgaming94 2 жыл бұрын
@zmonostudio plz tell me how you fix the only moving right
Raycast Weapons in Godot - Make an FPS in Godot Part 2
29:00
Code with Tom
Рет қаралды 57 М.
Optimizing my Game so it Runs on a Potato
19:02
Blargis
Рет қаралды 489 М.
БОЛЬШОЙ ПЕТУШОК #shorts
00:21
Паша Осадчий
Рет қаралды 11 МЛН
ПРОВЕРИЛ АРБУЗЫ #shorts
00:34
Паша Осадчий
Рет қаралды 6 МЛН
Cool Items! New Gadgets, Smart Appliances 🌟 By 123 GO! House
00:18
123 GO! HOUSE
Рет қаралды 13 МЛН
Can AI Code a Horror Game? Watch ChatGPT Try
8:06
BadGameDev
Рет қаралды 1,1 МЛН
Weapon Camera & Aim Down Sights - Make an FPS in Godot Part 5
23:49
Code with Tom
Рет қаралды 25 М.
What Goes Into Making A Multiplayer FPS?
3:33
Garbaj
Рет қаралды 171 М.
Simple Interactive Grass in Godot
13:17
Kasper Frandsen
Рет қаралды 34 М.
Let's Try: Godot Engine - Is it good?
9:38
Jonas Tyroller
Рет қаралды 305 М.
Переходишь с Unity на Godot? Посмотри это видео!
25:19
Тот Самый Келин
Рет қаралды 108 М.
Godot Engine - 2023 Showreel
5:33
Godot Engine
Рет қаралды 506 М.
How To Make A Doom Clone In Godot 4
27:57
MizizizizTutorials
Рет қаралды 69 М.
ВСТРЕТИЛ БРАТА НА ДОРОГЕ😎
0:20
MEXANIK_CHANNEL
Рет қаралды 3,3 МЛН
Reaksiyasiga qoyil.
0:12
Javohir Avto
Рет қаралды 1,9 МЛН
TANK 500 | Краш-тест   | ЕҢ ОҢАЙ | часть 1
10:10