Interactable Objects in Godot - Make an FPS in Godot Part 3

  Рет қаралды 39,872

Code with Tom

Code with Tom

Күн бұрын

In this video I will show you how to create Interactable Objects in Godot.
Source Code for this tutorial: github.com/codewithtom/godot-...
Part 2: • Raycast Weapons in God...
Source Code for Part 2: github.com/codewithtom/godot-...
Support me on Patreon: / codewithtom
Join the discord:
/ discord
This video covers creating a raycast weapon system in our FPS game, as well as inheriting from the base weapon to allow you to make modifications for new weapons and weapon types. We also add some simple UI to display the current ammo count and reloading status.
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

Пікірлер: 118
@RaiderJake
@RaiderJake 4 жыл бұрын
Great tutorials, sad there are only 3 but totally understand. I'm just getting into to game development and I'm in way over my head. These are SO helpful. I like that you include links to source code as well, nobody does that
@_cul8r_
@_cul8r_ 4 жыл бұрын
I'm really enjoying these tutorials, and I was sad to see there were only 3, but then I saw that this on was just made in Septeber, so I'm really hopeful that you will continue along, but as a fellow KZbinr, I understand how life can be. Cheers mate!
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thanks CuL8R, glad to here you're enjoying these tutorials. I've been taking a small break but I'll be back to making videos in December :)
@tylerneo
@tylerneo 4 жыл бұрын
@@CodeWithTom Hey Tom, it's March and just wondering hows it going?
@lordarty3315
@lordarty3315 4 жыл бұрын
@@CodeWithTom Hey tom, alright with u? i miss your tutorials :(
@vickylance
@vickylance 4 жыл бұрын
@@lordarty3315 He posted a tutorial 2 weeks ago :) cheer up
@fragarena9910
@fragarena9910 4 жыл бұрын
yay new video :D your tuts are very high quality
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you Frag!
@ashisharky
@ashisharky 4 жыл бұрын
Wonderful tutorial. I made an npc that triggers a dialog line for my rpg. Edit: also the lightswitch part was perfect for making a functional door.
@dzshiftt
@dzshiftt 4 жыл бұрын
Well, found your videos in the last few days, thank you for publishing something to comprehensive and easy to follow! I'm still learning my way around the godot engine, but so far this helped alot!
@CodeWithTom
@CodeWithTom 4 жыл бұрын
You're very welcome, thank you for checking out the channel I really appreciate it. I'm really glad you find the videos useful! 😁
@imthecatking
@imthecatking 2 жыл бұрын
Thanks so much for this tutorial, I'm building a game for a school project and I didn't know how raycasting, interaction, etc worked but this was simple and easy to understand, 10/10 tutorial!
@simoneleven338
@simoneleven338 4 жыл бұрын
Thank you so much sir for these amazing tutorials, please don't stop making as I need to learn much more like: -How to make intractable doors? -How to make my character crouch and prone? -How to make intractable objects with physics that the player can hold and manipulate (like in half life) -how to implement ragdoll (like when you shoot the enemy balls they fall to the ground) -How to give the player and enemies a health bars. How to make the enemies follow you using RayCast. -how to make the player go up stairs and ladders. These are just suggestions for future episodes I hope you put them into consideration.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you Simon. Fantastic suggestions. I'll be sure to try and cover some of those topics 😁
@blakecasimir
@blakecasimir 4 жыл бұрын
TBH what would be great is if the community could come together to create an FPS “engine” for Godot that features all of these things, menus, save / loads, level switching / hub code, classes for enemies / items / inventory etc already. Sort out all the coding and back end so that people can come in and make content / games with it.
@xenopulse
@xenopulse 4 жыл бұрын
@@blakecasimir There's a First Person Starter kit in the asset store that'll hopefully be expanded over time (or you or anyone could use it as a base for an expanded version): godotengine.org/asset-library/asset/424
@Amipotsophspond
@Amipotsophspond 4 жыл бұрын
one way to do it. if you think about "doors", "my character", and the "pickupable" as all things that have the "transform" section so perhaps a opening door is a slab that rotates and moves. if you look at early 80s games you see they used large blocks in place of doors that would simply move. so the my character including collusion shape what is crouching down but scaling it down so it's smaller, pickupable is the same moving is just changing it's location XYZ. now I would guess that a game engines has a better way of doing all of this that I would tell you if knew. so how to give them health bars that's like a ammo bar. so health would be a var like ammo but instead of going down when the player clicks it would be going down when the player collides with. so if you know the players XYZ it would be making enemies more towards that. their are some godot 2d guides on this, is 3d really as that different? the player going up stairs so perhaps a raycast at the players feet angled down that prevents collision with the floor by moving the player up. so when it encounters a stair it moves up so it can be on top of it. I don't know if this is the way to do this but it's the way I would try. the ragdoll this -> kzbin.info/www/bejne/eaLTZIOAhq6li8U but in 3d. oh kzbin.info/www/bejne/bma4oIuofNdpp7M
@smeister6274
@smeister6274 4 жыл бұрын
Keep it up! I have learned a lot from your tutorials. Thx!
@johnnyvulture6793
@johnnyvulture6793 2 жыл бұрын
amazing tutorial hands down one of the best i have watched
@themissinglink2163
@themissinglink2163 4 жыл бұрын
Excellent tutorial, Thanks. This fast-tracks learning. Much appreciated.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
You're welcome, thanks for the comment
@sablesanctum
@sablesanctum 4 жыл бұрын
Really enjoying this series. Thanks!
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you!
@Buli0n
@Buli0n 4 жыл бұрын
Please make more! This is very helpful!
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you, I certainly will
@caveirainvocada9438
@caveirainvocada9438 2 жыл бұрын
Amazing tutorial! Exactly what i wanted!
@321357w
@321357w 4 жыл бұрын
Interactable doors would be a great tutorial for the future and how the doors are animated. looking forward to new tutorials.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Great suggestion Jeff
@321357w
@321357w 4 жыл бұрын
@@CodeWithTom Would be interested if it can be done with script from an object imported from Blender or if the Blender object would require the animation files.
@TobeasJ
@TobeasJ 2 жыл бұрын
Thanks for the tutorial. This is very helpful!
@TheMaxthesis
@TheMaxthesis 4 жыл бұрын
Very good! Enjoyed this and learned a lot!
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Awesome! Really glad you enjoyed it
@mystikk3025
@mystikk3025 2 жыл бұрын
Great tutorials! you can follow it or break out a little I LOVE IT
@ZakRahman
@ZakRahman 3 жыл бұрын
Excellent series Absolutely brilliant.
@ralfbierig
@ralfbierig Жыл бұрын
Thank you! Very useful for my project.
@lemongummy7047
@lemongummy7047 4 жыл бұрын
Great tutorials!
@efimov90
@efimov90 4 жыл бұрын
15:05 Actually: Layer at collision means that switch can't detects player, but player can collide it, so for correct work you should set Mask attribute to Layer2
@Mrpaul20
@Mrpaul20 4 жыл бұрын
THANK YOU SO MUCH FOR THE TUTORIAL SIR ITS HELP ME A LOT
@CodeWithTom
@CodeWithTom 4 жыл бұрын
You're welcome 😊
@Scottagram
@Scottagram Жыл бұрын
Great tutorial, though I went off script at about 20:00 when I considered using signals instead of get_node. I'm still a noob at this but at least with my current prototype, it made more sense to segregate the functionality of buttons from the functionality of the linked objects. As a four-player splitscreen game there might be several people pressing a button at once, so I'm let the receiving end of the button be it a light or elevator or artillery piece decide what to do with the player input. Even before implementing them I've realised there could be situations where two players hit a button. Triggering the button twice through direct method calls could result in things like lights going on and off during the same frame.
@badmrbox
@badmrbox 4 жыл бұрын
I would love to see a wolfenstein-ish door tutorial. Never seem to find any of those ever.
@Yan-Digital
@Yan-Digital 4 жыл бұрын
Please I swear to god continue this serie
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Next part will be out very soon 😁
@Yan-Digital
@Yan-Digital 4 жыл бұрын
@@CodeWithTom No way man, truely my hero I swear !!! Thank you so much !!!
@ydkim8755
@ydkim8755 2 жыл бұрын
You are a great person.
@bkaunghtet8425
@bkaunghtet8425 4 жыл бұрын
Thank You for This tutorial sir. it helped me alot.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
You're very welcome
@user-wy7oh6tg1e
@user-wy7oh6tg1e 4 жыл бұрын
finally a new video!
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Hope you enjoyed it!
@321357w
@321357w 4 жыл бұрын
Hi Tom, just wondering if you have had the time and opportunity to do a tutorial on an interactive door as my strength is more with 3d modelling than actual code.
@DawidFreeman
@DawidFreeman 4 жыл бұрын
Very good tutorial pls do more if you can
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you I will 😁
@Funtaman
@Funtaman 2 жыл бұрын
Hi Tom. I really like your Godot tutorials. They are awesome! I'v bin looking at many tuts and I have yet to find tuts that are very well explained as yours. I want to request a tut on how to make a loading screen with a progressbar. There are a few on KZbin but they don't go in detail. Could be nice to see a menu scene where you press start then go to loading screen.. loading.. and then go to a new scene.. thanks for nice tutorials. Have a great day
@Dragon20C
@Dragon20C 3 жыл бұрын
Hello tom, I was wondering if you have a recoil tut avaliable for the guns?
@SketchwareTutorials1
@SketchwareTutorials1 4 жыл бұрын
hey make a tutorial on how to add weapon models and make shooting animation
@N4SKK
@N4SKK 4 жыл бұрын
great tutorial
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you Renan. It's on the list to cover AI state machines. It's a pretty big topic though so I just need to work out how best to cover it. Possibly start with a simple state machine and move on to more advanced ai at a later date.
@waywardpooch9567
@waywardpooch9567 4 жыл бұрын
@@CodeWithTom That seems like the smartest way to build towards the concept. Could probably refactor the player's code to have a state machine for that first, then move on to basic AI following, which naturally leads to pathfinding, etc. It would be great to have a short video sometime on how to program viewbobbing; I just figured out an easy way to do that building off your first FPS tutorial, but I know many people probably haven't figured that out yet. At the end of the day, just keep rocking it, man! You're definitely in the mix for best Godot tutorial producers already, in my opinion.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you so much Wayward! I'll try and squeeze in a video about head bobbing at some point 😁
@retrotechnical9294
@retrotechnical9294 3 жыл бұрын
sir you are awesome i found gold in your tutorial
@titustech7219
@titustech7219 2 жыл бұрын
sadly i had to delete every thing i followed in this vid because it wouldnt work but thank you other than this tutorial every thing has worked
@darkyassin
@darkyassin 4 жыл бұрын
Hi Tom, is it possible to continue on this tutorial and create a basic UI inventory and pickup items? That would be amazing.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Good suggestion, I'll see what I can do :)
@KellenChase
@KellenChase 4 жыл бұрын
This is what I’m looking for too :)
@riedewaanbey617
@riedewaanbey617 4 жыл бұрын
A FPS in android would be great if you could find the time. Even just the basic movement with 2 joysticks.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Mobile touch controls is something I'll definitely be covering in the future
@jlewwis1995
@jlewwis1995 4 жыл бұрын
you should make a tutorial on view bob, recoil, and aiming down the sights :) Oh and basic enemy AI as well
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Head bob has been requested a few times so I'll do that soon 😁
@KellenChase
@KellenChase 4 жыл бұрын
Stuck with the default interaction label across the bottom of my screen from first load even when not interacting. Can’t seem to get it to change whether I go over to the object or not. Can’t get a response in the output from the print command when using the interaction key. Any thoughts?
@sergeiorlov5096
@sergeiorlov5096 3 жыл бұрын
Helo Tom, and thank you for your tutorials. I've followed your tutorials, quite literally symbol-by-symbol, nad still get this annoying error after declaring the (current_collider = null), at 5:51... The error is something to do with the class name, but I'm oblivious to what (since the code worked for you, without any errors). The error is: The class "Interacteble" couldn't be fully loaded (script error or cyclic dependency). Any help with that? P.S. Thanks again for your work.
@tsk5328
@tsk5328 2 жыл бұрын
Hi, not sure if this relates, but I also ran into a problem there (but possibly a different problem) basically if I hit the interact key looking into empty space the game would crash, the interactions were not triggering and the interaction text did not display properly. What fixed my problem was checking the tab spacing. this is the only point in the video where Tom forgets to leave an empty line after moving to a new code segment affecting a "different" part of the code, the elif added on line 14 "elif current_collider:" (at this point in the vid 5:51) should be in line with the if statement on line 8 "if is_colliding() and..." (at the same timestamp) if it lines up with the wrong if statement funny stuff starts happening. This might not help at all, and it's been like 10 months, but still worth eliminating the easy fixes. Hope this helps and if not, I hope this message gives you a bit of extra motivation on your game dev journey.
@bitmammothOG
@bitmammothOG 4 жыл бұрын
how would we go about adapting this to third person, I know its similar but would the raycast be attached to the player model head instead of camera directly?
@wulfric_2
@wulfric_2 4 жыл бұрын
It would probably work with the RayCast stuck to the camera still as long as you are aiming at it but try both ways to make sure
@austinahuman7566
@austinahuman7566 Жыл бұрын
Could i use this for dialog? Similar to puppet combo style games, where the name of the object comes up and a dialog box pops up on screen when i interact with the object
@vickyboi1200
@vickyboi1200 4 жыл бұрын
are you going to upload more vids?
@n._x3319
@n._x3319 2 жыл бұрын
your amzing
@barrycelliers4552
@barrycelliers4552 3 жыл бұрын
pls tell boute crouch wepon change and meele wepons
@cenullum
@cenullum 4 жыл бұрын
Can you make cull masking the weapon so we can see it while inside wall
@CodeWithTom
@CodeWithTom 4 жыл бұрын
I'll add it to my list :)
@pierrenagonio
@pierrenagonio 4 жыл бұрын
Great tutorial's man here. Sub is ON. Waiting for next godot tips. BTW, I wiil sell U next subject: try to use controller for your FPS. Tried but works in half. Only movement. No luck for camera with right stick :/ Looks like it's to hard for me to make controler like Dark Souls did.
@alekosthecrow
@alekosthecrow 4 жыл бұрын
How can I make an automatic weapon? if it extends the weapon script, I can't hold left click so do I need to copy the entire script and change the "is_action_just_pressed"?
@wulfric_2
@wulfric_2 4 жыл бұрын
you can do that or you can change the weapon scripts button to be is_action_pressed and make the fire rate really low and probably a few other things to make it work more like a automatic
@supposedly2478
@supposedly2478 9 ай бұрын
On my interactable lightswitch script, i keep getting an 'unexpected identifier in class body' error for the exported variables. The scripts are exactly the same from mine to the one shown. Any ideas?
@panderz_gg
@panderz_gg 2 жыл бұрын
Great tutorial overall. Sometimes a bit fast though.
@brainblox5629
@brainblox5629 2 жыл бұрын
Hi Tom, I got a little problem. Referencing to my Interaction Label doesnt work, I always get an "attempt to call function ...in base null instance etc."
@turinturambar7806
@turinturambar7806 2 жыл бұрын
same lol
@holomode1357
@holomode1357 3 жыл бұрын
how to make actually bullets appear when you shoot?
@ganeshsingh4702
@ganeshsingh4702 3 жыл бұрын
its saying Attempt to call function 'set_text' based on 'null instance' on a null instance plz help me
@Theinvalidmusic
@Theinvalidmusic 4 жыл бұрын
Got to say, I'm a little puzzled as to what you did to get this to work. I followed the tutorial to the letter, but when declaring 'Interactable' as a class, Godot threw an error back saying that it was already declared due to me creating the script. This then resulted in Godot refusing to reference the class as part of the InteractionRaycast. Now I'm an absolute novice when it comes to this stuff, but surely that can't be right?
@sergeiorlov5096
@sergeiorlov5096 3 жыл бұрын
Dude, same exact issue. and I dont think that neither Tom nor anyone else will ever help us with this issue... Have you found out the sollution that you can point at ?
@p2bh506
@p2bh506 4 жыл бұрын
Sir, Where is the rest of the videos???
@drbackrooms2205
@drbackrooms2205 2 жыл бұрын
Can someone help me with the "If is_colliding() and collider is interactable:" Here say "error(13,38): The identifier "Interactable" isn't declared in the current scope" Please someone help me i tried to fix more than 100 times
@benjeminpenguin5764
@benjeminpenguin5764 2 жыл бұрын
Don't know if you ever figured this out, but try saving the scripts (ctrl + S)
@kulak8548
@kulak8548 Жыл бұрын
Did you add var collider = get_collider() at the top of _process(delta)?
@HelpMe-or1ki
@HelpMe-or1ki 4 жыл бұрын
Could you continue with an online fps? thx
@CodeWithTom
@CodeWithTom 4 жыл бұрын
I won't be adding online functionality during this series. However I will no doubt cover multiplayer in a future video. 😀
@problemletstalknoletschat2288
@problemletstalknoletschat2288 2 жыл бұрын
Does this still work in v3.4.4?
@wiktorwektor123
@wiktorwektor123 3 жыл бұрын
1. Just press Ctrl+D on node to duplicate it. No need to search again for the node already in scene. 2. If you deleting whole new script and leaving only "extend" keyword line just set Template: None when creating script. You will save time.
@gdmattartz3071
@gdmattartz3071 4 жыл бұрын
in my screen the interaction_label.set_text("") on func set_interaction_text(text) is not working it gives me an error said Attempt to call function 'set_text' in base 'null instance' on a null instance. anyone knows why? Edit: now i fixed it then my problem if i interacted another object it shows an error like the interaction_label.set_text??????
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Hi GD, make sure you're not trying to call a function on a non-interactable object using the "object is Interactable" syntax as shown in the video.
@gdmattartz3071
@gdmattartz3071 4 жыл бұрын
@@CodeWithTom Thanks!
@drbackrooms2205
@drbackrooms2205 2 жыл бұрын
@@CodeWithTom can you help me with the "If is_colliding() and collider is Interactable"
@drbackrooms2205
@drbackrooms2205 2 жыл бұрын
It says the identifier "Interactable" isn't declared in the current scope
@moric4677
@moric4677 4 жыл бұрын
shortcut for Duplicate objects is ( ctrl + D)
@CodeWithTom
@CodeWithTom 4 жыл бұрын
I might do a video on Godot keyboard shortcuts 😁
@FenyEro
@FenyEro 4 жыл бұрын
It's so simple especially since I can barely speak English, I almost said to myself forward the codes to you now comes the set_get_interactionsgetyield("getLighttexr(Pi.get_lighttextifon(lightisOn.if!).get_transform(Vector3.direction))"), and who knows this memorize? the developers and 3-4 man?
@chantolove
@chantolove 3 күн бұрын
Here from 2024, where scancodes are outdated. At 10:29, you probably want to use "var key_action = InputMap.action_get_events("Interact")[0]" and "var key_string = OS.get_keycode_string(key_action.physical_keycode)" instead.
@mellowcool6462
@mellowcool6462 4 жыл бұрын
pls men make more videos
@mickeykais8148
@mickeykais8148 4 жыл бұрын
collider in Interactable always returns false. :(
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Try "collider is Interactable" 😁
@Simplisti.
@Simplisti. 3 жыл бұрын
Lmao, i just realized everytime a problem occurs during this tutorial, i make a comment, and then like 30-60 seconds later, i resolve it without even going online, or getting a reply. Then I delete the comment. Basically, I'm increasing my brain power and getting good at resolving problems *kind of* because of the tutorial. # End of line
@sarahbuti6959
@sarahbuti6959 3 жыл бұрын
it doseintwork
@thegamebums6791
@thegamebums6791 4 жыл бұрын
For a second I was busy getting mad that the scripts weren't working and blaming u for it. Turns out that i just dumb and turns out that I just spelt something wrong
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Haha it happens :D
@juliusdamian1795
@juliusdamian1795 4 жыл бұрын
6.30 6:30
@unworthy.potato
@unworthy.potato 3 жыл бұрын
For me 17:07
@user-yf5un7kj1p
@user-yf5un7kj1p 8 ай бұрын
your tutorial doesnt work it was something about "couldent pars global class interactable"
@spurdojenkins1932
@spurdojenkins1932 3 жыл бұрын
You're doing it wrong. Everything needs to be it's own scene.
Simple FPS Enemy AI in Godot - Make an FPS in Godot Part 4
22:56
Code with Tom
Рет қаралды 32 М.
FPS Character Controller in Godot - Make an FPS in Godot Part 1
33:29
Code with Tom
Рет қаралды 164 М.
Red❤️+Green💚=
00:38
ISSEI / いっせい
Рет қаралды 75 МЛН
Interact with Objects in your World in Godot 4
9:25
Flyn San
Рет қаралды 14 М.
Tierlisting the BEST (and worst) GAME ENGINES
33:51
BiteMe Games
Рет қаралды 206 М.
Raycast Weapons in Godot - Make an FPS in Godot Part 2
29:00
Code with Tom
Рет қаралды 57 М.
4 Godot 4 Devs Make 4 Games in 44 Hours
25:19
DevLogLogan
Рет қаралды 493 М.
Using AI to Create the Perfect Keyboard
12:05
adumb
Рет қаралды 1,4 МЛН
Godot 4 - An Overview of Control Nodes | Easy UI (Tutorial)
25:48
Making Minecraft from scratch in 48 hours (NO GAME ENGINE)
16:38
Make Your First Game in Godot in 2020
39:38
Code with Tom
Рет қаралды 52 М.
Red❤️+Green💚=
00:38
ISSEI / いっせい
Рет қаралды 75 МЛН