Tutorial: First Person Movement In Godot 4

  Рет қаралды 155,233

Bramwell

Bramwell

Күн бұрын

Пікірлер: 402
@wellhellotherekyle
@wellhellotherekyle 2 жыл бұрын
So two things had changed since this video was published... 1. The _unhandled_input part, the code should read like this now: _unhandled_input(event): (All the stuff after on that line in Branwell's code is no longer necessary) 2. deg2rad() has been renamed to deg_to_rad() (Thank you to Andy Reed for pointing this one out) Thanks for the wonderful tutorial Bramwell!
@mando1570
@mando1570 2 жыл бұрын
thank you so much my guy your comment really helped me ❤
@gustaafmilzink
@gustaafmilzink Жыл бұрын
Thank you!
@recker7017
@recker7017 Жыл бұрын
point 1 is invalid, typehints never were necessary
@Micahtmusic
@Micahtmusic Жыл бұрын
maybe not necessary, but definitely polite
@sechmascm
@sechmascm Жыл бұрын
The other stuff on that line improves performance by a huge margin. The engine doesn't have to guess what everyting is supposed to be and it runs those operations faster. If you want a good game, it is necessary.
@erin1569
@erin1569 2 жыл бұрын
Btw, if you want to have the same autocomplete as Bramwell at 11:47, you should go to Editor>Editor Settings>Text Editor>Completion>Add type hints
@dabeanie9426
@dabeanie9426 Жыл бұрын
TYSMMMMMMM
@trxlly
@trxlly Жыл бұрын
Thanks
@mayodiff2245
@mayodiff2245 Жыл бұрын
what a legend
@Marandal
@Marandal 11 ай бұрын
Thank you.
@Zetsu_Org
@Zetsu_Org 10 ай бұрын
Bro thanks alot I was scared that's I did wrong
@justcnoon
@justcnoon 2 жыл бұрын
deg2rad() has been renamed to deg_to_rad() in Alpha 15, if anybody's having an error.
@mustafamohamud5212
@mustafamohamud5212 2 жыл бұрын
thank you!
@wordrc
@wordrc 2 жыл бұрын
thanks!!
@wellhellotherekyle
@wellhellotherekyle 2 жыл бұрын
You're a life saver!
@NirielWinx
@NirielWinx 2 жыл бұрын
Good. That 2 was cringey as hell :D
@jameswashington4704
@jameswashington4704 2 жыл бұрын
@@NirielWinx no it wasnt u mf I will fight u
@alechussak3750
@alechussak3750 Жыл бұрын
set_mouse_mode() and get_mouse_mode() have been removed since this video was made. You can now get/set the Input.mouse_mode property directly: SET: Input.mouse_mode = Input.MOUSE_MODE_CAPTURED GET: if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
@gregoriodelimaalves6862
@gregoriodelimaalves6862 Жыл бұрын
how do I do this properly
@StephenCodess
@StephenCodess 10 ай бұрын
thanks!
@NerdWithABeard
@NerdWithABeard 9 ай бұрын
This, along with the tip for how to access the other command auto-fills, are much appreciated
@351c4v71
@351c4v71 8 ай бұрын
thanks, that was very helpful
@351c4v71
@351c4v71 8 ай бұрын
func _unhandled_input(event): if event is InputEventMouseButton: Input.mouse_mode = Input.MOUSE_MODE_CAPTURED@koolgabieboi2816
@I_can-t_GAMING
@I_can-t_GAMING Жыл бұрын
والله انا كنت واقف على ان الشخصية بتخترق الارض لكن دا اكتر فيديو فادني فشكرا جدا 💖💖💖💖❤❤ By God, I was standing on the fact that the character penetrates the ground, but this is the most useful video, so thank you very much
@sweetdog2398
@sweetdog2398 6 ай бұрын
A cool thing you can do with this part: var input_dir := Input.get_vector("move_left", "move_right", "move_forward", "move_backwards") var direction = (neck.transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized() if direction: if is_on_floor(): velocity.x = direction.x * SPEED velocity.z = direction.z * SPEED else: if is_on_floor(): velocity.x = move_toward(velocity.x, 0, SPEED) velocity.z = move_toward(velocity.z, 0, SPEED) is right before the velocity stuff you can add a if is_on_floor so that you cant change directions midair, or you can use an else comman so that you can but its less.
@kevindean8312
@kevindean8312 Жыл бұрын
I am complete noob to Godot and this tutorial was excellent. Easy to follow and loved how you actually explained everything. Thank you!
@petethorne5094
@petethorne5094 2 жыл бұрын
This is absolutely brilliant! I just downloaded the Beta (woo!) and within a few mins I had a player running around my test scene. Bought your course a while back and now that things are getting more stable, I'm going to have to stop avoiding building a game!
@kevindean8312
@kevindean8312 Жыл бұрын
So was Godot 3.x not very stable?
@cultofape
@cultofape 2 жыл бұрын
Love your tutorials! If I can make a request - 3rd person 3d with LMB click on ground movement and proper player rotation. I just can´t make it 100%right
@BramwellWilliams
@BramwellWilliams 2 жыл бұрын
I could do something like that for sure ^^ I've done something like that with gridmaps for tiles you can move to: twitter.com/bramreth/status/1453508866134663174
@grarldbrown6812
@grarldbrown6812 Жыл бұрын
I'm just hoping to use LMB method for camera3D, similar as the way of tutorials does but classic rpg.
@madphoenix9826
@madphoenix9826 10 ай бұрын
Always nice to find a information dense tutorial for the specific thing you wanna do ^^ Thank you very much!
@Drachenbauer
@Drachenbauer Жыл бұрын
i didn´t add a neck node, i rotate the whole character around y instead with the mouse, so i just didn´t get the problem of fixed forward direction, that´s described at 16:15. It feels just like a fully functional first person charecter.
@hayleypeterson7007
@hayleypeterson7007 7 ай бұрын
This is still such a great tutorial, but I wanted to add that if anyone's gotten a bug when adding camera movement, the fix for me was this line to check MouseMotion was the event type: if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED and event is InputEventMouseMotion:
@wolcamophone4783
@wolcamophone4783 2 жыл бұрын
I wish there was a video that really explained how to better understand movement functions tied to kinematic bodies so that you could know exactly what kind of bhopping or air strafing glitches to put in movement fps controllers.
@riisezz0
@riisezz0 2 жыл бұрын
Hey, man. I'm new to Godot and you've really been helping in the transition to Godot 4. I really appreciate you!
@pisel5945
@pisel5945 Жыл бұрын
thank you i had no idea how to do something in godot because there was always errors, i didnt think that i will succed following the first tutorial that i clicked on
@darkBuster2002
@darkBuster2002 Жыл бұрын
there is a problem for me Line 17:Assignment is not allowed inside an expression.Line 18:Assignment is not allowed inside an expression.
@foldysnootmack
@foldysnootmack Жыл бұрын
I’m having the same issue. Have you figured out how to fix it?
@nezbro2011
@nezbro2011 Жыл бұрын
@@foldysnootmack Double equals so type ==
@P134-i3p
@P134-i3p Жыл бұрын
@@nezbro2011 Bloody hell really??? DOUBLE EQUALS??? God damn. Good thing I check the comments for answers... Fucking double equals...
@nezbro2011
@nezbro2011 Жыл бұрын
@@P134-i3p Yeah not really obvious at first considering there isn't a gap in between the two.
@darkBuster2002
@darkBuster2002 Жыл бұрын
@@foldysnootmack No
@pommefrites
@pommefrites Жыл бұрын
Hey, kind of semi-related but this video helped me fix a long-standing issue with the stair catcher in my character controller being offset if my character starts the level rotated at all, which is fine if the player always starts in the same direction with 0,0,0 rotation, but not great if they do, which is most often the case. It has to do with the lines you highlighted around 17:17 and I used a very similar block to calculate the position of the stair catcher ray cast to swing around in the direction of player movement. I then just had to offset it vertically from the neck height to be near the floor and now it works perfectly no matter which direction the player starts in. Anyway, it had been bugging the hell out of me for a whiiiiile, so thanks for your help!
@dairygecko
@dairygecko 7 ай бұрын
thank you so much, i was watching another tutorial and it skipped the part in which the player was created, im a complete newbie, now i can continue the other tutorial (which was about creating a map)
@chrisfritz7545
@chrisfritz7545 Жыл бұрын
Just wanted to say thanks for sharing your knowledge. Keep making these videos. You have a great way of explaining what you are doing.
@YOZA.
@YOZA. 10 ай бұрын
extends CharacterBody3D const SPEED = 5.0 const JUMP_VELOCITY = 4.5 # Get the gravity from the project settings to be synced with RigidDynamicBody nodes. var gravity: float = ProjectSettings.get_setting("physics/3d/default_gravity") @onready var neck := $Neck @onready var camera := $Neck/Camera3d func _unhandled_input(event: InputEvent) -> void: 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) if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED: if event is InputEventMouseMotion: neck.rotate_y(-event.relative.x * 0.01) camera.rotate_x(-event.relative.y * 0.01) camera.rotation.x = clamp(camera.rotation.x, deg_to_rad(-30), deg_to_rad(60)) func _physics_process(delta: float) -> void: # Add the gravity. if not is_on_floor(): velocity.y -= gravity * delta # Handle Jump. if Input.is_action_just_pressed("ui_accept") 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", "forward", "back") var direction = (neck.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 = move_toward(velocity.x, 0, SPEED) velocity.z = move_t
@daniyarm2922
@daniyarm2922 Жыл бұрын
why complicate, it is enough to add in the _input (event) function: func _input(e): (well i shorten the EVENT like this :)) ) if e is InputEventMouseMotion: rotation.y -= e.relative.x * 0.005 head.rotation.x = clamp(head.rotation.x - e.relative.y * 0.005, -1.4, 1.4) You can change the numbers however you like. He is only responsible for speed and limit.
@JohnFenlon
@JohnFenlon Жыл бұрын
Just started using Godot, very helpful video to get up & running quickly, many thanks 👍
@apersimmon
@apersimmon 8 ай бұрын
I applied this to a 3rd person player but it was very useful, thanks!!
@Dave-n5d
@Dave-n5d 11 ай бұрын
12:22 Where did he get this string of code from i dont understand how he got it
@kitsunemusicisfire
@kitsunemusicisfire 3 күн бұрын
copied and pasted it from a document he had on his pc, just retype all the code and it'll work fine
@KhaoticSanctum69
@KhaoticSanctum69 Жыл бұрын
I have an issue on line 17 of the code that says "assignment is not allowed inside an expression" and idk what's wrong :( can someone please help
@Ren-vo8jj
@Ren-vo8jj Жыл бұрын
its 2 equal to signs "=="
@randomdamian
@randomdamian Жыл бұрын
15:45 deg2rad() was renamed to deg_to_rad()
@Snakemaster11235
@Snakemaster11235 16 күн бұрын
tysm Bramwell this helped me alot
@NarekAvetisyan
@NarekAvetisyan 2 жыл бұрын
Very nice! Can you also make a simple tutorial like this for a Age of Empires style camera?
@PanIsTrying
@PanIsTrying 7 ай бұрын
Thank you kindly for your help in this tutorial. It made me a subscriber
@emilyallen7912
@emilyallen7912 7 ай бұрын
same
@petethorne5094
@petethorne5094 Жыл бұрын
Might be a bug here, if you rotate the Player node in the editor the movement keys are not mapped to the camera any more...
@petethorne5094
@petethorne5094 Жыл бұрын
My hacky fix here is to rotation the basis by the player rotation: var direction = ((neck as Node3D).transform.basis.rotated(Vector3.UP, rotation.y) * Vector3(input_dir.x, 0, input_dir.y)).normalized()
@jessepinkeye2339
@jessepinkeye2339 6 ай бұрын
I tried doing that but the keys are still not following the camera when I rotate the Player
@gameinglizard6984
@gameinglizard6984 Жыл бұрын
OK SO WHEN I AM TOUCHING THE GROUND ITS LAGGY AND WEIRD, it MIGHT BE CLIPIONG idk how do I fix that.
@reduxek
@reduxek 7 ай бұрын
I have this problem too
@sgaming3174
@sgaming3174 Ай бұрын
Thanks for the tutorial
@PAPRPL8
@PAPRPL8 2 жыл бұрын
Thanks for the tutorial; found it quite helpful and moved at a pace I found keep up with as a beginner.
@Fadam_red
@Fadam_red Ай бұрын
I get a error at camera.rotate_x(-event.relative.y * 0.01) Identificer "camera" not declared in current scope
@18_leafclover
@18_leafclover 3 ай бұрын
I'm getting an error on lines 20, 21 Identifier camera not declared in the current scope
@RealJesus
@RealJesus Жыл бұрын
help everytime i look down/right the poc starts spinning and it's uncontrollable
@harryudal3115
@harryudal3115 8 ай бұрын
Thank you so much for all the work you have done, this has given me so much help. And I thank you
@pacobrian7547
@pacobrian7547 Жыл бұрын
you are a genius, you solved my problem of collisions
@idk-gq8tw
@idk-gq8tw 10 ай бұрын
Can someone help, i started the scene and when i try to rotate is freezes and it says kennedy.gd 10 @ _ready(): node not found: "neck/camera3d" (relative to "/root/node3d/characterbody3d").
@MrJasonSnell
@MrJasonSnell 2 жыл бұрын
found a couple code fixes for clamping the vertical view camera.rotation.x = clamp(camera.rotation.x, -(PI/4), PI/4) or camera.rotation.x = clamp(camera.rotation.x, deg_to_rad(-30), deg_to_rad(60))
@eliyahumedia
@eliyahumedia Жыл бұрын
how would clamp the horizontal view? like this?: camera.rotation.y = clamp(camera.rotation.y, -(PI/4), PI/4)
@meteroy17
@meteroy17 Жыл бұрын
Is there a way to add other functions like interact, running, crouching, and all that?
@swedishgamedev
@swedishgamedev Жыл бұрын
Thank you for this very clear tutorial! It helped a bunch!
@Streamlesstv
@Streamlesstv 2 ай бұрын
My jump animation is 60FPS, but my walk animation is 3FPS with 'basic_movements' script. How to fix it ?
@matturner6890
@matturner6890 2 ай бұрын
Won't work :/ "Error at (17, 33): assignment is not allowed inside an expression" I have it copied perfectly, not sure what's wrong.
@DavidLeather-eh5ze
@DavidLeather-eh5ze Ай бұрын
i have a SLIGHT problem. cant download directly to my laptop the usb ports have water damage to the point they dont work i dont have the wifi drivers to connect to the internet with it and this dude just copy pasted a bunch of code i tried to type and i have errors that he doesn't.
@ЙенФенФыр
@ЙенФенФыр Жыл бұрын
why do we need this neck if we can rotate the whole character?
@SyedSaad-ug8uc
@SyedSaad-ug8uc 2 ай бұрын
Why turn your neck when you can rotate your body?
@7hroomy
@7hroomy 2 ай бұрын
LOL REAL ​@@SyedSaad-ug8uc
@sogimarvaz
@sogimarvaz Жыл бұрын
Very nice video, thank you so much Bramwell.
@acedefective2220
@acedefective2220 8 ай бұрын
thank you, this tutorial was very accessible and helpful
@wukerplank
@wukerplank 2 жыл бұрын
Very interesting, thank you for putting this together!
@Creeg81
@Creeg81 6 ай бұрын
i have a problem where when i look up or down, the camera starts spinning around and gets messed up. anyone kjnow how to fix this
@billyboiisaredneck8965
@billyboiisaredneck8965 Ай бұрын
I had a question but how do i remove my cursor from the screen?
@ViralShorts8303
@ViralShorts8303 Жыл бұрын
Hey man thank you so much its working very good and i am very happy!! you just got a Subscriber😉
@ChichiKugel
@ChichiKugel 6 ай бұрын
Hey, I'm new to Godot as well as programming lol. Can someone show me how to get a maximum visibility for the y axis?
@burntbrownie
@burntbrownie 7 ай бұрын
Anyone know why the playermodel gets frozen sometimes when walking into walls?
@justmrkoala
@justmrkoala Жыл бұрын
the camera looking around script is like totally not working with me it bugs out and doesnt work smoothly what did i do wrong sorry it was a typo also awesome tutorial btw, most tutorials are complex and assume u already know the basics of godot layout this one clearly pointed out what to inser tand what you are doing
@sakochekerjian8633
@sakochekerjian8633 2 жыл бұрын
when I added velocity.y it says velocity has not been declared yet
@BramwellWilliams
@BramwellWilliams 2 жыл бұрын
As of Godot 4 velocity is a member variable of the CharacterBody3D is the script definitely extending that? -> Also the velocity should already be there as part of the template Godot created when you created the script which makes me suspicous something may have already gone awry
@Poshmurf83
@Poshmurf83 Жыл бұрын
Same please help.with the issue
@PlasmaGhost303
@PlasmaGhost303 4 ай бұрын
the tutorial was great! thank you
@mr.e4327
@mr.e4327 6 ай бұрын
Great tutorial, thanks mate!
@eyejar234
@eyejar234 Жыл бұрын
Thank you very very much with your help I finaly make 3d first person controller 😃😃😃
@shigsy2630
@shigsy2630 Жыл бұрын
I've written the equivalent in C#, which requires a few differences other than the syntax (e.g. you cant directly modify the Rotation properties so need to create a separate Vector3 and set it to the Rotation, then manipulate and clamp that new Vector 3 before setting the Rotation back to the Vector3). This generally works fine but there is one odd behavior... I can't move the mouse and walk at the same time. So I can stand still looking around with the mouse, or I can walk around with the keys, but I can't do both at once. Any ideas? I suspect differences in how C# handles the Input events. If I'm holding W to walk and then move the mouse at the same time, it doesn't appear to be passing an InputEventMouseMotion event to my _UnhandledInput method. It executes the code in that method but not within the "if" that's checking for the InputEventMouseMotion, so presumably the event is something else (like the key im holding down to walk). If I stop moving (let go of W) and move the mouse, it correctly passes the InputEventMouseMotion to the _UnhandledInput method and I can look around fine.
@mrunion
@mrunion Жыл бұрын
Care to share your experiment with C#?
@trueblue97
@trueblue97 11 ай бұрын
This is all cool and good, but how do I make camera controls with the right stick on a controller instead of the mouse?
@RivenbladeS
@RivenbladeS 6 ай бұрын
why doesnt godot have buttons to instantiate cube plane culinder etc like unity and you have to set the mesh instance yourself?
@badmusicproducer_offical
@badmusicproducer_offical 3 ай бұрын
HOW DO I MAKE THE CAMERA EVEN LESS FAST?
@EMDthe1
@EMDthe1 3 ай бұрын
Where should I add the jump animation
@delegalco
@delegalco Жыл бұрын
How he get the arrow on the some lines of code ->
@chompplays1137
@chompplays1137 5 ай бұрын
Can someone tell my why this doesnt work func _unhandled_input(event: InputEvent) -> void: 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) if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED: if event is InputEventMouseMotion: neck.rotate_y(-event.relative.x * 0.01) camera.rotate_x(-event.relative.y * 0.01) rotate_y(-event.relative.y * 0.01) camera. rotation.x = clamp(camera.rotation.x, deg_to_rad(-30), deg_to_rad(60)) "anglerfish man".rotate_x(-event.relative.y * 0.01) It says (24,30) : Cannot find property "rotate_x' on base "String"
@NONAME-rk2lg
@NONAME-rk2lg Жыл бұрын
i keep getting theese errors "Line 26:Function "is_on_floor()" not found in base self.Line 27:Identifier "velocity" not declared in the current scope.Line 30:Function "is_on_floor()" not found in base self.Line 31:Identifier "velocity" not declared in the current scope.Line 38:Identifier "velocity" not declared in the current scope.Line 39:Identifier "velocity" not declared in the current scope.Line 41:Identifier "velocity" not declared in the current scope.Line 41:Identifier "velocity" not declared in the current scope.Line 42:Identifier "velocity" not declared in the current scope.Line 42:Identifier "velocity" not declared in the current scope.Line 44:Function "move_and_slide()" not found in base self"
@JorgeRosa
@JorgeRosa 2 жыл бұрын
Very cool!
@midnightwaffles243
@midnightwaffles243 6 ай бұрын
now i need to learn how to model and i can make my liminal space game
@rockyhut7778
@rockyhut7778 4 ай бұрын
I don't think I can move my head on a laptop or the code doesn't work, can someone explain! I have restarted at least 20 times
@jstarandomdude
@jstarandomdude 4 ай бұрын
code?
@omanwalter7587
@omanwalter7587 Жыл бұрын
For some reason my code is not working could somebody just copy past it to me
@ChristianMendezJr
@ChristianMendezJr 2 ай бұрын
As a beginner, I used this tutorial and everything works fine, just one thing, when i change how large my plain is and test it i clip through the floor. does anybody know how to change that?
@AverageFallout
@AverageFallout 2 ай бұрын
Is your Collionshape3d large enough?
@TheAnimationGuide-tf8vz
@TheAnimationGuide-tf8vz Ай бұрын
When you update it you have to update the collision mesh by either remaking it or scaling it
@NuggetEater-ws7yr
@NuggetEater-ws7yr Жыл бұрын
for some reason when i tried to get a character body it didnt show up when i searched it
@emilyallen7912
@emilyallen7912 7 ай бұрын
bro is a god
@BuffHobbit
@BuffHobbit 2 жыл бұрын
16:00 this is all good but does the player body rotate with the neck? so that the head doesn't just spin around while the body is not. So the body is facing the same way we are looking
@MaydayAcademy
@MaydayAcademy Жыл бұрын
Hey, thank you so much for the tutorial. Coming from Unity, it's the first time trying Godot (v4.1.1). However, if I play the scene, it runs super laggy (never had the problem with Unity) although 32 GB RAM and Nvidia RTX 3050 GPU. Anybody knows what could be the problem? I expected Godot to run better than Unity actually
@grimmey1541
@grimmey1541 10 ай бұрын
I fixed it! What you need to do is make sure that you are using the right type of mesh for your player. Make sure its the simplfied one and not the fancy pancy one. Thats what worked for me.
@Aneemkhann
@Aneemkhann Жыл бұрын
i did what you told me but my character body is not moving nor the camera
@adaml.5355
@adaml.5355 2 жыл бұрын
This is an extremely helpful video.
@Will_-it3mh
@Will_-it3mh 9 ай бұрын
if i tlit the camera to the up and down limits it goes haywire and starts spining to the sides. how do i fix that?
@S.Johannesson
@S.Johannesson 7 ай бұрын
Thank you for this!
@itokuun
@itokuun Жыл бұрын
Awesome video man
@IMDAGER
@IMDAGER Жыл бұрын
I learned so much thank you
@panderz_gg
@panderz_gg Жыл бұрын
Hey, I am trying to figure out how to add inertia to this character controller. Of course meaning it takes time to stop and time to get going again. I can't figure out how to modify this code to do it. Anybody got a suggestion for me to help figuring this out?
@panderz_gg
@panderz_gg Жыл бұрын
@@benhunter8551 hey thanks for the suggestion bro! Unfortunately I had not much time to continue learning because of work but, from memory (am on vacation so I do not have the code infront of me) I created a workaround. I created variables that defined standstill velocity and maximum velocity. Then I created a while loop which basically said that when input is pressed and on ground do "while player is moving and not = max_speed do current max speed + 0.01" same when no input is pressed but -0.01. It worked as far as I can tell but I am sure that solution will create undesired behavior. I will check out your suggestion when I am back. Thanks again!
@Bazmefaizeraza
@Bazmefaizeraza 8 ай бұрын
How to make a joystick and play with it
@Mrtubb158
@Mrtubb158 11 ай бұрын
7:44 i had a problem with being able to move because whenever i pressed the arrow keys it wouldnt do anything so idk what i did wrong Edit:I figured it out
@Cheesetaco2
@Cheesetaco2 7 ай бұрын
Thank you.
@Ciac18
@Ciac18 Жыл бұрын
thank you so much for this tutorial
@ThaMentalGod2003
@ThaMentalGod2003 Жыл бұрын
yo thx for making this godot 4 tutorial 😎
@pocoace5415
@pocoace5415 Жыл бұрын
thanks alot now i created my first godot game
@bleh1186
@bleh1186 2 жыл бұрын
Some extreme jitteryness while looking and moving, any idea what's going on with this?
@Stop_803
@Stop_803 9 ай бұрын
I did what you did and on line 17 it gave me an error saying “assignment is not allowed inside an expression”
@Baconfwies
@Baconfwies 8 ай бұрын
So basically just add 2 equal signs instead of one and swap out deg2rad with deg_to_rad. That should work
@Stop_803
@Stop_803 8 ай бұрын
@@Baconfwies dang a little late I just went too 2d instead of
@Baconfwies
@Baconfwies 8 ай бұрын
@@Stop_803 oh sorry
@Stop_803
@Stop_803 8 ай бұрын
@@Baconfwies it’s fine I wanted to start with something simple first anyways. I was trying to jump straight to a 3D game . Even though I never coded before
@Baconfwies
@Baconfwies 8 ай бұрын
@@Stop_803 That’s the good way to do it! Be proud of your patience.
@olmrgreen1904
@olmrgreen1904 2 жыл бұрын
Awesome video!
@Clan_GG
@Clan_GG Жыл бұрын
How would I change the mouse for looking to touch screen I currently have If event is InputEventscreendrag: ≤. ≥ input.set
@Rebel_MC2355
@Rebel_MC2355 Жыл бұрын
at 12:21 how do you get those lines of code? im typing them in rn and its very annoying
@lancebenson4891
@lancebenson4891 3 ай бұрын
# Sensitivity of mouse movement var mouse_sensitivity = 0.3 # Vertical rotation clamping var min_angle = -90 var max_angle = 90 var current_vertical_rotation = 0.0 func _ready(): # Hide and capture the mouse cursor Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) func _input(event): if event is InputEventMouseMotion: # Horizontal rotation (Yaw) rotate_y(deg_to_rad(-event.relative.x * mouse_sensitivity)) # Vertical rotation (Pitch) current_vertical_rotation -= event.relative.y * mouse_sensitivity current_vertical_rotation = clamp(current_vertical_rotation, min_angle, max_angle) # Apply the vertical rotation to the camera Camera.rotation_degrees.x = current_vertical_rotation func _process(delta): # Toggle mouse capture on pressing 'Escape' if Input.is_action_just_pressed("ui_cancel"): if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED: Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) else: Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
@hasheslibs4212
@hasheslibs4212 Жыл бұрын
it's use rotate_x and rotate_y than other and exactly
@onicringe6017
@onicringe6017 4 ай бұрын
extends CharacterBody3D const SPEED = 5.0 const JUMP_VELOCITY = 4.5 # Get the gravity from the project settings to be synced with RigidBody nodes. var gravity = ProjectSettings.get_setting("physics/3d/default_gravity") @onready var neck := $neck @onready var camera := $neck/Camera3D func _unhandled_input(event): if event is InputEventMouseButton: Input.mouse_mode = Input.MOUSE_MODE_CAPTURED elif event.is_action_pressed("ui_cancel"): Input.mouse_mode = Input.MOUSE_MODE_VISIBLE if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED: if event is InputEventMouseMotion: neck.rotate_y(-event.relative.x * 0.01) camera.rotate_x(-event.relative.y * 0.01) camera.rotation.x = clamp(camera.rotation.x, deg_to_rad(-30), 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("ui_accept") 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", "forward", "back") var direction = (neck.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 = move_toward(velocity.x, 0, SPEED) velocity.z = move_toward(velocity.z, 0, SPEED) move_and_slide()
@bblucat_
@bblucat_ Жыл бұрын
Great Video keep it up!
@UsernameOnVR
@UsernameOnVR 4 ай бұрын
I just fall through the floor
@Panda12boy
@Panda12boy 7 ай бұрын
i cant turn with the mouse
I Paid Fiverr Game Developers to Make the Same Game
10:25
BadGameDev
Рет қаралды 700 М.
Как мы играем в игры 😂
00:20
МЯТНАЯ ФАНТА
Рет қаралды 3,1 МЛН
HAH Chaos in the Bathroom 🚽✨ Smart Tools for the Throne 😜
00:49
123 GO! Kevin
Рет қаралды 15 МЛН
From Small To Giant Pop Corn #katebrush #funny #shorts
00:17
Kate Brush
Рет қаралды 69 МЛН
Миллионер | 1 - серия
34:31
Million Show
Рет қаралды 1,7 МЛН
Optimizing my Game so it Runs on a Potato
19:02
Blargis
Рет қаралды 590 М.
How to Start Making Games with No Experience
10:55
Goodgis
Рет қаралды 62 М.
How I Fan 3D Cards in Godot 4
9:53
Bramwell
Рет қаралды 36 М.
I Made a Graphics Engine (again)
8:27
Zyger
Рет қаралды 171 М.
I made a game in 30 days with NO experience
8:10
Maxikyu
Рет қаралды 7 М.
My Experience Moving to Godot from Unity
16:54
DarkDax
Рет қаралды 26 М.
Juiced Up First Person Character Controller Tutorial - Godot 3D FPS
10:47
Godot's Hidden Level/Map Editor
3:39
Garbaj
Рет қаралды 136 М.
How You Can Easily Make Your Code Simpler in Godot 4
6:59
Bitlytic
Рет қаралды 430 М.
Как мы играем в игры 😂
00:20
МЯТНАЯ ФАНТА
Рет қаралды 3,1 МЛН