As badunius pointed out, a capsule shape is better for collision because it is a simpler shape. When you're creating a collision shape make sure to use that. This has been updated on github. Also make sure to turn on collisions for any CSG boxes you add or you will fall through the floor.
@tftc97
Жыл бұрын
where do i do that???????????????????????????? edit: nvm
@kinggreen9073
Жыл бұрын
I said the same thing bro@@tftc97
@Kirico_gd
Жыл бұрын
hey do you still reply under older videos, if yes do you know why my camera moves on both x and y axis when i load the game
@sourlesscream1272
Жыл бұрын
@@Kirico_gd Head pivot is for horizontal rotation and Camera is for vertical the camera portion of the script should look like this head.rotate_y(-event.relative.x * SENSITIVITY) camera.rotate_x(-event.relative.y * SENSITIVITY) camera.rotation.x = clamp(camera.rotation.x, deg_to_rad(-45), deg_to_rad(45))
@dynstinn
Жыл бұрын
can you add crouching please, i need this character controller for a horror game im making, i REALLY need crouching
@pixels_per_minute
6 ай бұрын
One of the best First Person tutorials I've ever found for Godot. A LOT of other videos seem to throw out the sample code for far more complex code that just dose the same basic stuff in a different way. I like how you just build off it instead, and provided us with a simple, yet highly configurable base. I also learned a few tricks I can apply in my 2.5D character controller since it also uses the same sample code. From here, I'll be looking to add in a raycast system in order to see what the player is looking at and maybe a menu system, which I now know how to do thanks to people like you!
@legiongames2400
6 ай бұрын
Thank you friend! :) I'm really glad I get to help out
@badunius_code
Жыл бұрын
0:45 technically capsule collision shape gotta be better for perfomance, because you have to solve just one primitive collision, whereas a convex hull is solved on per face basis.
@legiongames2400
Жыл бұрын
Oh yeah that actually makes sense.
@deadturret4049
Жыл бұрын
way better for performance. You could argue that the capsule is calculating 3 shapes, (2 spheres, 1 cylinder), but the calculations to do those is ludicrously simple and fast. Switching to face collisions is not great.
@Spuds1411
7 ай бұрын
I've always just used a cylinder for character collisions! I've found its the simplest possible shape which also gives the best results for collisions!
@souvikdatta97
Ай бұрын
@@Spuds1411when it comes to slopes though I think it is better to use capsule
@yusarimahubara
Жыл бұрын
The best simple head bob I could found in the internet, the other ones are overcomplicated and they didn't seem so nice, great job!
@legiongames2400
11 ай бұрын
Thank you! :)
@DePistolero
8 ай бұрын
YES, elegant, simple, tweakable, straightforward and bulletproof... Just starting godot( turnover from Unity ) more than 7 yrs of xp...
@Papajoofable
4 ай бұрын
@@legiongames2400Hey man! Cool vid, i really like that headbob. But, how can i make footsteps sounds with it? (I hate animation player and blend tree headbobbing)
@menacingskull740
4 ай бұрын
THE POWER OF ACTUALLY USING MATH AND ACTUAL FUNCTIONS IN GODOT
@ScratchyBlade7634
3 ай бұрын
i cant get it working and my camera is jsut stuck halfway in the floor for some reason
@homborgor
21 күн бұрын
Tip for people: When you set up the sprint mechanic, we start it with "if Input.is_action_pressed("Sprint"):" before starting the next line, add "and is_on_floor()" to make sure that the player cant "sprint" in the air, this also stops the player from being able to shoot forward in the air after standing still. So overall, you code should look like: if Input.is_action_pressed("Sprint") and is_on_floor(): speed = SPRINT_SPEED else: speed = WALK_SPEED Just swap it out if you want ✌✌
@jasonleeroberts
5 ай бұрын
this was amazing. incredibly fast, and concise. thank you! for any new game devs like me who couldn't figure out the collision at the beginning of the video: Just click CSGBox3D, and in the CSGShape3D menu on the right, click the checkbox next to "Use Collision". Make sure to do this for the other boxes you make for the level too. You can CTRL+click all the boxes you want to add collision to and add it to all of them at once.
@jaythewolf7216
3 ай бұрын
big help thank you. i was going through and adding a collision node to everything lol
@AdrianLong-yx6zh
2 ай бұрын
Thank you so much.
@BurritoByte
10 ай бұрын
Hello LegionGames! I wanted to thank you for creating this video. I recently wrapped up my Godot 4 FPS prototype and this video played a monumental role in getting the initial player controller implemented and working for my project. I just published my video of it on my page and have added you in the game's credits as a thank you for this tutorial video. Thanks so much again and looking forward to future uploads!
@legiongames2400
10 ай бұрын
Thank you friend! :) I'm really glad it helped you out!
@WeirdBrainGoo
Ай бұрын
A 4 FPS game sounds pretty slow, I hope you can bump it up to 5 in the future. 🤞
@Dawid30303
Жыл бұрын
great tutorial, thanks a lot. To anyone new to godot, if you are confused about what a function is doing, then i recommend printing out the variable the function is modifying. This helped me understand a few things a bit better
@legiongames2400
Жыл бұрын
That's a great idea even if you're not new to godot haha, thank you for watching!
@wolcamophone4783
Жыл бұрын
I find it easier to pull better snippets of code and explanations from random tutorial vids than to watch tutorials on specific subjects as some tutorials will mislead you from what you want to actually accomplish in your code.
@dapperwolf465
Жыл бұрын
Wait
@dapperwolf465
Жыл бұрын
HOLD ON YOU GAVE ME A IDEA!
@spinnysponk778
Жыл бұрын
@@dapperwolf465what js ur idea
@steviewonderisnotblind5833
6 ай бұрын
@@bamb00zld flexing your credentials on a tutorial video is pretty embarrassing
@NINELIVECORP
5 ай бұрын
@@bamb00zldfax cuh fix yo hairline
@badunius_code
Жыл бұрын
5:15 or even better, you can rotate your entire body along the Y axis and not just your head. Shadows will give you away if you'll switch to a non symmetrical body.
@legiongames2400
Жыл бұрын
Very good point.
@Jacklo-the-catsect
Жыл бұрын
thank you for this, until I rotated the head, the body didn't rotate, and so I looked backwards then walked forwards, I'd be going backwards, but rotating the body fixed that.
@itsaducklin
Жыл бұрын
@@Jacklo-the-catsect well thats cause you multiplied the direction by the forward vector of your actual player, not your head (not trying to justify using the head, just sayin)
@cassis2325
Жыл бұрын
This fix is also better in the way that now your starting rotation of the body doesn't have to be zero in the engine. Now you can rotate the entire body to your hearts content in the engine without it messing up local an worldposition's whilst walking
@mattg6550
Жыл бұрын
Just for anyone running into trouble here, you will be replacing head.rotate_y(-event.relative.x * SENSITIVITY) with rotate_y(-event.relative.x * SENSITIVITY) to accomplish this, since if we rotate_y (or do any translations or rotations without specifying what we are translating or rotating) we will enact this on the 'scene' that the script is attached to, in this case the root "Player"
@jorge2555
2 ай бұрын
I won"t lie I had trouble keeping up but this tutorial helped me figure out how to apply inertia easier so thank you for that hopefully ill be able to comprehend the rest as i continue messing with Godot. Wish me luck!
@t3st3d
Жыл бұрын
thanks! i just switched from unity to godot and this is the most helpfull tutorial i have found so far
@legiongames2400
Жыл бұрын
Hey welcome to the engine haha, I'm glad you're enjoying my videos
@Flexyhandz
Ай бұрын
Sifted through like five other camera videos and this is the one that solved my problems.
@stevedowning3892
Жыл бұрын
Absolutely wonderful tutorial, thanks so much. I am a rank n00b to game dev in general, having downloaded Godot last week. I found it super instructive to type the script along with the video, but to use the Git download to help with fault-finding, when I inevitably made mistakes.
@MerrStudio
8 ай бұрын
One thing that's easy to miss cause the effect is subtle but if you have no velocity you don't reset t_bob value so your camera could be shifted ever so slightly from the bob when not moving anymore.
@thricemindblown7883
11 ай бұрын
My favourite was the headbob function. That "->" should come in handy.
@MizziePeasy
5 ай бұрын
I am starting now on the game dev world and this was the first video I found that didn't bore me to death! Straight to the point and great humour! I was planning on doing a single player arena shooter and you have the perfect video. Thank you so so much, I really hope you have lot of success in your life ☺
@indieology7336
Жыл бұрын
This is awesome! Thank you for your great work!
@legiongames2400
Жыл бұрын
Thank you! :)
@LaurenNapier-uk4yk
7 ай бұрын
This was exactly what I needed while I'm learning, thank you! Now for that extra juice I gotta find some way to add a little acceleration and hopefully a faster initial jump speed like source games...
@ivan-_-8577
3 ай бұрын
Thank you. A very nice controller and lots of clear and useful code examples!
@InHUM44n
Жыл бұрын
For anyone wanting to untie player movement from physics tickrate: For me moving move_and_slide() to _process(delta) instead of _physics_process(delta) fixed the "laggy" 60fps camera translation movement. Now my physics framerate is 30 to save performance on the CPU and it still feels good :)
@kabebu_
11 ай бұрын
I've been searching for the cause of those "lag spikes" for 2 days... Thank you :')
@annoyingkittycat6449
9 ай бұрын
I've heard if a big lag spike hits it can completely mess up your physics engine if you do this from another youtuber, but I'm not sure if its true
@VikuGEE
23 күн бұрын
This was amazing and so straight forward! Thank you for sharing this!!
@Marcusvlogs
5 ай бұрын
Really good tutorial. I like that it was fast and informative but didnt get bogged down into every little gritty detail
@captainnelson9833
11 ай бұрын
This is the best tutorial for a FPS character controller. Your code is just too clean for human eyes.
@legiongames2400
11 ай бұрын
Thank you friend! :)
@murrrr8288
14 күн бұрын
Great video! Exactly what I was looking for :)
@PastaMaster115
4 ай бұрын
This is a suggestion for a good mouse handling format. That way you can capture and uncapture the mouse super easy and also the camera doesn't move when the mouse is visible. #Capture mouse handling if event is InputEventMouseButton: Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) elif event.is_action_pressed("ui_cancel"): Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) #Mouse movement if event is InputEventMouseMotion and Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED: head.rotate_y(-event.relative.x * SENSITIVITY) camera.rotate_x(-event.relative.y * SENSITIVITY) camera.rotation.x = clamp(camera.rotation.x, deg_to_rad(-40), deg_to_rad(60))
@DarkestMirrored
7 ай бұрын
this seems very useful! the one thing i'd REALLY like to see would be stair handling? none of the player controller tutorials seem to care about being able to use stairs.
@legiongames2400
7 ай бұрын
Yeah stairs are a little more difficult tbh, I would love to make a more complete controller one day, but there's a really well-made video that describes the concept in general concepts: kzitem.info/news/bejne/qoKMu5eVsohjZ5wsi=rZX2XExOCMyssIs3
@Godot-Bro
Ай бұрын
Thanks for this! I'm pretty new to Godot and only just now touching 3D. Very helpful resource.
@MichaelFoxtrot
10 ай бұрын
I have never had to pause a video so many times lol 10/10 would recommend
@legiongames2400
10 ай бұрын
Music to my ears
@micahjorgenson8057
2 ай бұрын
For anyone who’s FOV was going way too high whenever they moved I found that changing the velocity_clamped variable at the very end of the line to SPRINT_SPEED * 1.3 instead of having it times 2 fixed the issue.
@mhp9868
Ай бұрын
I'm not into making games but it was really fun to play around in Godot. Looking forward to add guns and zombies. Thanks for the tutorial!
@m0nste_
7 ай бұрын
Thank you so much for this tutorial. I've never really gotten into coding before, so I'm attempting to learn Godot to get into the swing of things. I would love to see another video perhaps diving into crouching implementation as well as crouch sliding! :)
One thing I noticed is that there was a blurr on the edges of ojects when rotating the camera, this is because the rotation is calculated on the physics layer intbeween frames when it should be calculated on the frame layer _process().
@ProbablyM_S
Жыл бұрын
you can include camera tilt when moving in a direction it looks really cool in part 2 ,can add sound effects for jumping,landing, running, add particles and crouch/sliding hehe ik its too much but would love to see that
@legiongames2400
Жыл бұрын
Yeah all of these would be really important for most games!
@ProbablyM_S
Жыл бұрын
@@legiongames2400 is this a taunt or you are serious? 😂
@legiongames2400
Жыл бұрын
@@ProbablyM_S LMAO my bad if that sounded sarcastic. No, I'm serious, sound effects are a little tricky here so would be cool to do a vid on that. Plus extra camera movement like a little drop when you land, tilt on strafe, etc would make it even more juicy.
@ProbablyM_S
Жыл бұрын
@@legiongames2400 haha its fine
@px8
Жыл бұрын
@@legiongames2400 you should do this!! pleaase!
@tje.o.a5477
6 ай бұрын
Thank you my dude, this has helped me remake my character controller after I switched to fps!
@legiongames2400
6 ай бұрын
Thank you, I'm glad you enjoyed! :)
@okayoni6342
2 ай бұрын
Holy cow this one is a ton better than the other 40 minute tutorial I saw.
@ck88777
3 ай бұрын
great tutorial btw, good pace and straight to the point, just the way a tutorial should be
@OmniWareTeam
4 ай бұрын
If anyone is having issues with a certain error found in the console about _headbob. (This error: Standalone lambdas cannot be accessed. Consider assigning it to a variable.) The error you're encountering is due to the indentation of the _headbob function. In Godot, all functions need to be properly indented at the class level. Here is the corrected script: extends CharacterBody3D const SPEED = 6.5 const JUMP_VELOCITY = 6 const SENSITIVITY = 0.005 const BOB_FREQ = 2.0 const BOB_AMP = 0.08 var t_bob = 0.0 # Get the gravity from the project settings to be synced with RigidBody nodes. var gravity = 9.8 @onready var head = $Head @onready var camera = $Head/Camera3D func _ready(): Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) func _unhandled_input(event): if event is InputEventMouseMotion: head.rotate_y(-event.relative.x * SENSITIVITY) camera.rotate_x(-event.relative.y * SENSITIVITY) camera.rotation.x = clamp(camera.rotation.x, deg_to_rad(-40), deg_to_rad(60)) func _physics_process(delta): # Add the gravity. if not is_on_floor(): velocity.y -= gravity * delta # Handle jump. if Input.is_action_just_pressed("jump") and is_on_floor(): velocity.y = JUMP_VELOCITY # Get the input direction and handle the movement/deceleration. # As good practice, you should replace UI actions with custom gameplay actions. var input_dir = Input.get_vector("left", "right", "up", "down") var direction = (head.transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized() if direction: velocity.x = direction.x * SPEED velocity.z = direction.z * SPEED else: velocity.x = 0.0 velocity.z = 0.0 t_bob += delta * velocity.length() * float(is_on_floor()) camera.transform.origin = _headbob(t_bob) move_and_slide() func _headbob(time) -> Vector3: var pos = Vector3.ZERO pos.y = sin(time * BOB_FREQ) * BOB_AMP return pos
@nickhurst7493
4 ай бұрын
Thanks! This fixed my issue!
@wqiting_9545
Ай бұрын
Hey thanks man! I just have a problem with the last part func _headbob(time) -> Vector3: The error is error at (52, 36): Expected intendet block after lambda declaration. Parser Error: Cannot use shorthand "get_node()" notation ("$") on a class that isnt a node.
@flyingchubandar8600
Ай бұрын
Thanks !!
@nudgemepapi
18 күн бұрын
idk how this fixed my code but thank you
@Paulik76910
Жыл бұрын
Thanks for such a detailed tutorial.
@legiongames2400
11 ай бұрын
Glad you liked it
@x2-gamerz23
4 ай бұрын
if Input.is_action_pressed("zoom"): var target_fov = -10.0 camera.fov = lerp(camera.fov, target_fov, delta * 8.0) code for zoom function. (note: add a zoom input key in the project settings)
@blue123-m7h
Ай бұрын
Thanks for Tutorial LegionGames🤩😍🥰
@jac0b_
23 күн бұрын
super super awesome tutorial, thanks for your help and explanations
@sonicfan826
11 ай бұрын
This really helped me out, thank you for the tutorial and have a nice day
@legiongames2400
11 ай бұрын
Thank you for watching friend! :)
@TheMisterNebo
Жыл бұрын
Your content is great, you have a good pace (I like the 'faster' pace that you use), and Godot will be all the hype soon enough thanks to Unity's foolery. I subscribed, thank you so much for taking your valuable time to make this content for us. You make learning Godot fun!
@legiongames2400
11 ай бұрын
Thank you very much! :)
@TheValkire
11 ай бұрын
It would be amazing if you could do crouching and sliding based on current velocity (so you can slide down a slope).I've been trying to wrap my head around it for some days now without success... Great tutorial by the way!
@legiongames2400
10 ай бұрын
Cool idea! And thank you for watching! :)
@humbleraider6343
Ай бұрын
Thanks for the tutorial!
@Golvas
8 ай бұрын
Sadly I think this might be outdated now, as trying to make it exactly step by step as shown works with collision, but the very first movement script doesn’t function.
@itsdord
6 ай бұрын
Just thought I'd put it here, if anyone is using a ColorRect on the camera and not getting any mouse input, go to the ColorRect and mess with the mouse settings in the Inspector. It's typically on Stop
@StrawberryBongo
Жыл бұрын
thanks so much bro this is such a huge help!
@BlueCodingStudio
Жыл бұрын
Very useful, I am too lazy to write my own code, so hippity hoppity your code is now my property.
@legiongames2400
Жыл бұрын
Wouldn't want it any other way, hope you're enjoying Godot haha
@RandomGuyyy
Жыл бұрын
This video and the following in this zombie fps series are a good introduction to 3D in Godot 4.
@legiongames2400
Жыл бұрын
Haha thank you! :)
@RandomGuyyy
Жыл бұрын
@@legiongames2400 proper shooter tutorials with actual animated characters are thin on the ground for Godot so I hope the.algorithm catches wind of it.
@laithalsaj5243
Жыл бұрын
Hey! I know this is a bit late for a 2 months old video but can you also show me how we can implement the crouch mechanic as well the slide? That would be very helpful from you, Great tutorial by the way!
@ince55ant
Жыл бұрын
for crouching, just scale down the collision on vertical axis and lower the camera position. also you should do a line trace when uncrouching to make sure your character has the space to stand up for sliding do the same stuff but also stop using the player input for movement/velocity but instead store the forward direction when the slide is first activated and use it for the movement, then decelerate to taste until equal to crouched walkspeed then start using normal crouching behaviour. also make a state machine for movement. i.e. make an enum for movement states like walking/crouched/sliding. then use a switch/match statement to set the velocity in the way each of those states requires
@user-un2vb8mr6e
Жыл бұрын
Great video, could you make a tutorial that implements head *sway* as well as head bob. Where the head kind of leans/ or rotates side to side when you move side to side similar to in games like Quake, Devil Daggers, Ultrakill, DUSK etc.
@legiongames2400
Жыл бұрын
That'd be a cool feature for a potential part two, thank you for the suggestion
@user-un2vb8mr6e
Жыл бұрын
@@legiongames2400 you're tutorials are really great for learning godot. Im currently halfway through the third video. You're second video really helped me understand how to use scenes to create prefabs. Although I've had to use shapes like cylinders, squares and circles as the collision shape for the static bodies because the convex shapes were really bad performance wise at least for me. Anyway keep up the great videos.
@cynkcaj
5 ай бұрын
on the off chance you still care about this, just throw "camera.rotation.z = lerp(camera.rotation.z, deg_to_rad(YOUR DESIRED DEGREES) * input_dir[0], delta * YOUR DESIRED RATE OF CHANGE)" in your physics_process
@user-un2vb8mr6e
5 ай бұрын
@@cynkcaj thanks
@FrostyyByte
4 ай бұрын
if anyone is having errors blah blah: extends CharacterBody3D var speed const WALK_SPEED = 6.5 const SPRINT_SPEED = 8.0 const JUMP_VELOCITY = 6 const SENSITIVITY = 0.005 const BOB_FREQ = 2.0 const BOB_AMP = 0.09 var t_bob = 0.0 # Get the gravity from the project settings to be synced with RigidBody nodes. var gravity = 9.8 @onready var head = $Head @onready var camera = $Head/Camera3D func _ready(): Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) func _unhandled_input(event): if event is InputEventMouseMotion: head.rotate_y(-event.relative.x * SENSITIVITY) camera.rotate_x(-event.relative.y * SENSITIVITY) camera.rotation.x = clamp(camera.rotation.x, deg_to_rad(-40), deg_to_rad(60)) func _physics_process(delta): # Add the gravity. if not is_on_floor(): velocity.y -= gravity * delta # Handle jump. if Input.is_action_just_pressed("jump") and is_on_floor(): velocity.y = JUMP_VELOCITY # Handle Sprint if Input.is_action_pressed("sprint"): speed = SPRINT_SPEED else: speed = WALK_SPEED # Get the input direction and handle the movement/deceleration. # As good practice, you should replace UI actions with custom gameplay actions. var input_dir = Input.get_vector("left", "right", "up", "down") var direction = (head.transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized() if is_on_floor(): if direction: velocity.x = direction.x * speed velocity.z = direction.z * speed else: velocity.x = 0.0 velocity.z = 0.0 else: velocity.x = lerp(velocity.x, direction.x * speed, delta * 2.0) velocity.z = lerp(velocity.z, direction.z * speed, delta * 2.0) t_bob += delta * velocity.length() * float(is_on_floor()) camera.transform.origin = _headbob(t_bob) move_and_slide() func _headbob(time) -> Vector3: var pos = Vector3.ZERO pos.y = sin(time * BOB_FREQ) * BOB_AMP pos.x = cos(time * BOB_FREQ / 2) * BOB_AMP return pos
@cyclonebee2205
Жыл бұрын
Amazing tutorial! Learned a lot about gd script from this.
@legiongames2400
11 ай бұрын
Thank you! :)
@Thph793
5 ай бұрын
I don't get it. I get like 1-2 fps but when I jump and during the jump/fall and while falling through the void i get perfect 60 fps even when moving the camera, what is this and how can I fix it? I know that my pc isn't that bad so I don't get why I only get good fps while jumping / falling. I already tried disabling the sun fro example but it didn't help 1 bit.
@WeirdBrainGoo
Ай бұрын
Did you double-check your code? FrostyyByte copy-pasted the whole code further below, so you can try copying it to make sure also.
@thatoneguy6469
3 ай бұрын
When I got to the head bob part, after finishing the vertical bob, my player goes halfway through the floor, and collisions of objects randomly work, does anyone know what could be happening?
@TheMikeMassengale
4 ай бұрын
Great stuff keep it up!
@NextLevelLemon
11 ай бұрын
If you made an actual character model but it doesnt appear to turn with the camera, you can simply fix that by making the model a child of the Head node. (PS: You still have to make the collision shape a child of the Player.) (PPS: It will come at the cost of your collision not being too accurate so this line of code should fix that: "var.rotate_y(-event.relative.x * SENSITIVITY)" You can visualize the collision moving by making a csg box a child of it)
@itsaducklin
10 ай бұрын
Or just rotate the entire player body instead of the head on the y axis
@bloxtrider
6 ай бұрын
is it just me or all the godot tutorials way better and easier to understand than the unity ones...
@legiongames2400
5 ай бұрын
Godot is easier to understand than unity :D That's why I use it
@calumwoodward9489
5 ай бұрын
@@legiongames2400 please help im stuck in the ground even when i use your code from git
@Jacklo-the-catsect
Жыл бұрын
this helped thank you, although I would suggest 0.007 as the sensitivity, as it's much slower, but still fast enough, it also doesn't make you feel like you're on a rollercoaster.
@legiongames2400
Жыл бұрын
Yeah people tell me my mouse sensitivity is too high all the time tbh. :D
@itsaducklin
10 ай бұрын
i just multiplied it by the process delta time ._.
@fractalchaos8245
2 ай бұрын
amazing tutorial
@monopoly2170
Жыл бұрын
Great job! I would recommend using similar lerp functions to add acceleration/deceleration
@Hanham8turkey
9 ай бұрын
Every time I’d start up the game my “player” would fall through the floor.
@stupidsniper5216
8 ай бұрын
fax pls help
@finercandy45113
8 ай бұрын
enable collision on the csg box
@thepowernerd0
Жыл бұрын
Do NOT put a space in "Vector3" worst mistake of my life Very noob-friendly tutorial so far. This video is my first try at using Godot or any software. Gonna finish the sprint later today. Huge thanks!
@legiongames2400
11 ай бұрын
Thank you for watching!
@brokenEngineerMathAndPhysics
Ай бұрын
This tutorial is informative, but it is very fast paced. He clicks on a lot of stuff that you don't know and does so quickly. I recommend learning the official FPS tutorial on the godot website first. This is clearly not beginner level
@greenspecgaming169
5 ай бұрын
Hey, if anyone is having issues with not being able to move, make sure 'move_and_slide()' is in 'func _physics_process(delta):'
@johnc7389
11 ай бұрын
Tremendously helpful.
@ryan_isacow21
6 ай бұрын
Thanks a little fast but help understand how godots code works
@joefigura6132
Жыл бұрын
Great video, succinct and helpful
@ryzenslt8943
Жыл бұрын
Omg thanks so musch all the tutorials Are so old and war
@legiongames2400
Жыл бұрын
Thank you for watching!
@Harald723
Жыл бұрын
Great toutorial the code works perfectly and i can almost understand it!
@legiongames2400
Жыл бұрын
Thank you friend! Hopefully I can do better next time so you understand it all.
@Harald723
Жыл бұрын
@@legiongames2400 well im a beginner so I dont realy know how to code that much!
@GGfrostZ
10 күн бұрын
Major issue with the headbob. it does not take into account the original Y position of the camera so whenever you stop moving it sticks to whatever value it was at when velocity.length() = 0. Meaning, the camera could be at wildly different heights depending on BOB_AMP. EDIT: Here's how you could fix that. Replace this in your _physics_process function: if velocity.length() > 0 and direction != Vector3.ZERO: t_bob += delta * velocity.length() * float(is_on_floor()) camera.transform.origin = _headbob(t_bob) elif: camera.transform.origin = lerp(camera.transform.origin, original_camera_y, delta * 5.0) t_bob = 0.0 You need to define a variable named: original_camera_y. Then you need to put this in your func _ready(): original_camera_y = camera.transform.origin (you can also just set this to a hardcoded float for height like 0.0, but that's all up to you.)
@senseiscavern6140
3 күн бұрын
i exactly copied this code but shows a indentation error Expected conditional expression after "elif".
@ColdBlueLight
9 ай бұрын
thank you sir i was able to create a juiced up first person controller! and mod it to my likeing!
@WadeAnimations522
11 күн бұрын
Of course the fps starts with a bean
@LexGear
10 ай бұрын
Super helpful.
@arrtemfly
Жыл бұрын
oh this *was* very helpful and fun. thanks!
@legiongames2400
Жыл бұрын
Thank you! :)
@fjewjmviwp
3 күн бұрын
my camera locks on to the bottom of my bean instead of the head
@6lua
6 ай бұрын
Thank you so much! You helped me so much. Subscribed on you and liked the video.
@TupyBro
5 ай бұрын
ооо, неожидал тебя тут увидеть, я делаю свою игру а тут ты в коментах
@6lua
5 ай бұрын
@@TupyBro заебал
@windowpanememberrrr
4 ай бұрын
very helpful thank you very much
@Dragon20C
Жыл бұрын
Looks very cool!
@matturner6890
3 ай бұрын
Anyone else tearing their hair out trying to find ONE tutorial that will allow you to successfully program moving forwards?!?
@DonGeorgesTheThird
11 ай бұрын
Really great video! Small question though, any chance you can make a follow-up video showing how to handle a controller for motion? I mean, the direction is pretty straight forward as it is a simple mapping of the (in my case) left joystick to the created action (not to mention the jump and sprint buttons) but the camera adjustments are kind of tricky as the game listens to mouse move events (as an input) and for the joystick, it feels like the modification should happen in the _process or _physics_process code rather than from the event itself.
@DonGeorgesTheThird
11 ай бұрын
Right, after a tiny bit of fiddling, I found it out. Sharing cause it might be useful for someone. The first thing I did was to export the 3 lines handling the rotation in the _unhandled_input function to a dedicated function _handle_rotation taking x, y and sensitivity as parameters. I make sure to pass the final values of x and y (i.e. -event.relative.x). I pass the sensitivity as I want to have a different sensitivity for mouse move and joystick. So I created the input for the right joystick (look_up, look_down, look_left, look_right) and in the _physics_process, I get the values the same way I get them for the movement (Input.get_vector). If the return value is not Vector2.ZERO, I call the _handle_rotation function. Done.
@Drivinefire
9 ай бұрын
If you update camera bobbing inside the physics process won't the movement look jittery in higher refresh screens? I can't test it myself but maybe it would look smoother in the normal process.
@SunJaycy
8 ай бұрын
little tip. instead of typing onready etc. drop the node into the script but before dropping it in hold CTRL then release lmb
@womp47
8 ай бұрын
good tip
@Mr.Swiftyguy
8 ай бұрын
I did what you told but when i play my character doesn’t stand on the floor it just goes through it and fall into the void..
@finercandy45113
8 ай бұрын
enable collision on the csg box
@TheRemaindersYT
6 ай бұрын
This guy needs more credit!
@23grt
2 ай бұрын
Yeah the bean falls through the floor. Something mustve changed
@rejoiceinsanity
2 ай бұрын
In the CSGBox3d in the inspector, go to CSGShape3d and check use collision.
@itsaducklin
Жыл бұрын
Some fixes: rotate the head ONLY on the X, but rotate the entire player on the Y. This fixes issues with movement not being updated to your forward direction, or if you have a custom player model the shadow will be off. Also, if you see that your jumping is really snappy and not smooth, just make a new function in your script, like this: func _process(delta): // Your movement here and then copy and paste ALL of your code from the _physics_process to your _process. Makes it so much better :> You can also make a new onready variable at the top called friction. In that same line, set the friction to your speed variable divided by 6 (6 looked good during personal testing). It should look like this: @onready var friction = SPEED / 6 now, in the part where mr tutorial man here updated the smoothing code to just be set to 0, as it didnt work, put the smoothing code back in and replace the SPEED variable in those with friction. Now, you have silky smooth jumping and movement.
@369TurtleMan
11 ай бұрын
I wasn't a fan of how the FOV would zoom out and in twice every time you jumped (lol) so I used Vector2(velocity.x, velocity.z).length() in the clamp function instead. This makes it so the FOV doesn't increase while you fall, but I don't mind all that much.
@Alikespan
2 ай бұрын
For some reason _headbob(time) function offsets my camera underground
@Josh-op6dl
Ай бұрын
I had the same issue, check if you place the Head node position where the camera should be.
@nobodygivesadamn
14 күн бұрын
@@Josh-op6dl wait can you elaborate?
@solahifuefos9301
4 ай бұрын
Good video, but as a very beginner to godot ive had to put the video on 50% speed and keep needing to pause and rewind to catch what you're doing without getting instantly lost.
@THEBESTDEV-w2x
17 күн бұрын
Cannot infer the type of "direction" variable because the value doesn't have a set type. at 5:15
@MonkeyMan-idk601
8 ай бұрын
I have a problem with the camera I did all the code and I put it where I wanted it, but it keeps going to the bottom of the capsule
@Andruck
9 ай бұрын
Thanks bro, are the best :D
@EagleTopGaming
Ай бұрын
My controller direction get messed up any time I rotate the player to anything other then 0. Any idea what that might be or a way to fix this?
@homborgor
22 күн бұрын
For people wondering if this is worth watching, I just paid for a Godot course and I'm referring to this because this is 110% better and is taught in half the time 💀
@ducky_well
Жыл бұрын
nice , thank you
@kurochi4768
8 ай бұрын
Hey, I've been stuck at the first 3 minutes. I followed the instructions step by step. Yet for some reason, when I boot it up, I fall through the ground. Can someone help with this?
Пікірлер: 758