Weapon Camera & Aim Down Sights - Make an FPS in Godot Part 5

  Рет қаралды 25,992

Code with Tom

Code with Tom

Күн бұрын

In this video I'm going to be showing you how to add a weapon camera and aim down sights mechanic into your Godot FPS.
This tutorial covers the use of Viewports, Render Layers and Camera Interpolation.
For the full source code for todays video visit:
github.com/codewithtom/godot-...
To get the source code at the end of the previous lesson:
github.com/codewithtom/godot-...
Support the Channel:
/ codewithtom
Join the Discord Community:
/ discord

Пікірлер: 94
@danielhadad4911
@danielhadad4911 3 жыл бұрын
Thank you a million times, this series was amazing! I'd love to see anything you come up with for the next tutorials.
@mottely
@mottely 3 жыл бұрын
Don't usually comment on videos but these tutorials have been extraordinarily helpful. Looking forward to more, thanks for all the information!
@wzukay6648
@wzukay6648 4 жыл бұрын
I really love your FPS tutorials!!!
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you Adrian! More to come soon :)
@MRPiki-js4jg
@MRPiki-js4jg 3 жыл бұрын
@@CodeWithTom please make an animation rig and animation node editor tutorial next
@jojofansiraq998
@jojofansiraq998 4 жыл бұрын
I love your FPS tutorial, hope to see the next part 💥💪
@tonalegoni6404
@tonalegoni6404 4 жыл бұрын
Love ur tutorials, they're amazing and simple. Thanks a lot for making me start loving godot. ready for part6 👍👍👍
@DonLeeelbow667
@DonLeeelbow667 2 жыл бұрын
wow after the 3rd time watching this I finally realized I had is_action_just_pressed instead of is_action_pressed. Thank you for the fantastic turorial, I just wish I could follow instructions better!
@supriyakhanra9068
@supriyakhanra9068 4 жыл бұрын
Thank u Tom for giving such wonderful tutorials I am new to godot ( basically a unity user) I actually want to know more about godot So thanks
@midasmyad
@midasmyad 4 жыл бұрын
great! banging it out without too much blah blah. All the info i need and to the point. This is why I watch you!
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thanks Myriad, really appreciate it! :)
@samuelecalugi7975
@samuelecalugi7975 3 жыл бұрын
I love this series! Hope to see new video!
@liveshaitan9086
@liveshaitan9086 3 жыл бұрын
it is the best with the help of your tutorials I had make a fps character game in godot
@5minutemovies977
@5minutemovies977 3 жыл бұрын
I've been trying to make a multi viewports set up, but somehow I've not been able to pull it off. I went on your channel looking for something else, but when I saw this video, I suddenly forgot what I wanted in the first place !
@तंत्र
@तंत्र 3 жыл бұрын
Amazing tutorial.... Loved it...more godot content would be really nice....
@techofhappiness395
@techofhappiness395 4 жыл бұрын
Really Awesome Tutorial
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Glad you liked it!
@RedHeadphone
@RedHeadphone 4 жыл бұрын
I was stuck at this thanks now I m all motivated
@NOPerative
@NOPerative 4 жыл бұрын
Incredible work.
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thanks Robert I really appreciate it!
@hshsjsjsj506
@hshsjsjsj506 4 жыл бұрын
Yoooooo the part 5 im waiting haha
@AgnisNeZvers
@AgnisNeZvers 3 жыл бұрын
This is amazing, but this is also needed to have different FOV on weapons for correct animations. But it also is bringing the next problem - enemies can have the same guns, so it's needed to switch those rendering layers. Also, muzzle flash is needed to be on a separate layer if the gun is with the player.
@HasanRx7
@HasanRx7 4 жыл бұрын
There is actually a flag for materials called "No Depth Test". If you check it for the gun material, it will draw the gun above everything in the scene which fixes clipping problem in just one click. However, I'm not sure how reliable it is though, as when I used it with a 3D plane mesh displaying UI elements in the 3D world through a viewport texture,, it did still have the clipping problem with that. I learned this accidentally from one of the Godot tutorials in KZbin and liked to share it with you.
@vickylance
@vickylance 4 жыл бұрын
I think with the help of this method we can also do one more cool thing. Set higher FOV for the main camera and low FOV for the weapons camera
@CodeWithTom
@CodeWithTom 4 жыл бұрын
@@vickylance yeah absolutely. If you use a single camera and mess around with the FOV the weapon starts to look very strange 😁
@973sandman
@973sandman 3 жыл бұрын
@GrGoGamer thanks for this comment 🙏🏻, I checked and it works just fine, enable no depth test and set the render priority higher (default is 0, I used 1 for the weapon, higher values are in front). The weapon doesn't clip and receive lights and shadows.
@HasanRx7
@HasanRx7 3 жыл бұрын
@@973sandman Your welcome. Glad it helped 😁
@973sandman
@973sandman 3 жыл бұрын
@@HasanRx7 I did some more detailed tests with more complex meshes and unfortunately it started to give problems, in the end I solved with the viewport and the second camera following another tutorial, lights and shadows seem to work too. However, it is useful to know that there is that possibility for other features.
@garbaj
@garbaj 3 жыл бұрын
Hey Tom, have you found a fix to the lighting issue with viewports? My gun ends up with strange looking lighting compared to the rest of the world and it doesn't share the adjustments that I've made in the WorldEnvironment node (like glow and ambient light). I've tried enabling the gun's visual instance layer in my light nodes, but it doesn't seem to do anything. Let me know if you have any insight.
@973sandman
@973sandman 3 жыл бұрын
I was wondering the same thing, in the video you can clearly see that once the render layer changes, the weapon no longer receives lights or reflections. Besides those it would be interesting to test the shadows
@greatvaluehokage139
@greatvaluehokage139 2 жыл бұрын
Yoooooooooooo it's Garbaj!!!
@dradex9562
@dradex9562 2 жыл бұрын
big fan
@phoxpsy7236
@phoxpsy7236 2 жыл бұрын
see even celebs need help sometimes RESPECT+ to bad tom thinks so highly of himself he can reply. >.>
@kiloalpha1067
@kiloalpha1067 Жыл бұрын
@@phoxpsy7236 maybe he just doesn't have time
@asdaaaaaaaaaaaaaasd
@asdaaaaaaaaaaaaaasd 3 жыл бұрын
this is perfectly helpful
@rainxcat7753
@rainxcat7753 3 жыл бұрын
This is awesome :D
@ishkapoor7931
@ishkapoor7931 4 жыл бұрын
This was a really lit video! I loved it... a better way to use scope (one can be animation player/tree). But I'm looking forward implementing it... Also it would be great if you can implement same thing on a Mixamo 3d rigged character(rather than on a capsule)!!! But I've followed your tutorial and I love them
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you Ish. Yes there are several ways to implement scoping, however AnimationPlayer isn't great for dynamic animations, so with this approach you can define a different scoped position for each individual weapon.
@ishkapoor7931
@ishkapoor7931 4 жыл бұрын
@@CodeWithTom Yes you're right. thank you for teaching this. This works much better than what I used earlier.
@CitroenGames
@CitroenGames 4 жыл бұрын
i really love godot i still going to use unreal becuse i have to finish a game first. but this engine is really easy and thank you for good quality tutorial!
@Gredran
@Gredran 2 жыл бұрын
Thank you so much for recommending asset forge. I know it’s paid, but the fact that Kenney releases SOOO many assets for free, it doesn’t hurt to support such an incredible tool for a measly 20 bucks if you’re able :) Thanks so much for the tutorials!
@DerkJanSpeelman
@DerkJanSpeelman 2 жыл бұрын
nice video! Couldnt you do an animation instead of having 2 position to interpolate from when ads?
@suretmeyenateistoc4252
@suretmeyenateistoc4252 2 жыл бұрын
thanks for video
@anime_gamer9567
@anime_gamer9567 4 жыл бұрын
Hello Code with Tom Please give us a 6th part
@GlitchedK
@GlitchedK Жыл бұрын
Amazing tutorial but I have a few questions, how would I add animations to the guns like reload, fire, equip, and unequip? How would I add a weapon inventory system? And how would I add limited ammo?
@baileymckee1700
@baileymckee1700 2 жыл бұрын
Maybe next you could do particles coming out the gun and music and sfx and a title screen and make a health bar and the enemy shotting Plus love the vids
@RedHeadphone
@RedHeadphone 4 жыл бұрын
So I have a pickup system so I am switching layer visual instance of mesh one thing I noticed was when viewport shows the gun the gun colouring changes it becomes brighter how can I solve it this bug stands out bad
@nbk4191
@nbk4191 4 жыл бұрын
Finally part 5 and the part 6 where?
@danylbekhoucha6180
@danylbekhoucha6180 3 жыл бұрын
Nice tutorial. The only issue with the weapon in another viewpoint is that it can't receive the lighting and reflect the environment, this can be very annoying in the interior with contrasted lighting with omni lights. I haven't found a technique for that.
@garbaj
@garbaj 3 жыл бұрын
@@Zorochase Hi, I'm having similar issues. I've tried enabling the visual instance layers for the gun but it doesn't seem to do anything. The lighting still looks strange and doesn't have any of my worldenvironment adjustments (like glow). Any idea what I'm missing?
@fragarena9910
@fragarena9910 4 жыл бұрын
Love it
@cmds.learning7426
@cmds.learning7426 4 жыл бұрын
cool tom! i wait for this for ....how long?
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Glad you liked it :)
@Shortclipsyt9
@Shortclipsyt9 4 жыл бұрын
Nice 👍
@CodeWithTom
@CodeWithTom 4 жыл бұрын
Thank you!
@leeramer171
@leeramer171 3 жыл бұрын
Hi Tom, I was wondering if you have tried your FPS as a multiplayer. I am having trouble assigning my second client to my player 2 kinematic body. apparently when a both clients connect they take the default of Ply1 viewpoint, but Client 2 sees Ply2 in front and can control them while client 1 can control itself normally. Any ideas on how to assign ply2 to client 2?
@tsk5328
@tsk5328 2 жыл бұрын
did you ever manage to figure this out? it might have to do with the setting up of the camera path, I saw in the comments thread of one of the earlier videos in this series that someone mention a problem where all the enemies would turn red when only one spotted the player, even if only that one was persuing. in that instance, the fix was to make sure each instance of the enemy object was handled as a unique entity, that's how they fixed their problem. I hope this helps with your issue. you can find the convo in the chat of video 3 or 4 (of this series) I think, the episode where he adds the enemy with the pursuit feature? you'll find it in the chat there (sorry can't remember the episodes name :-) side note, can other players see the gun on the guns layer in the second player's hand and if so, can player 2 see player 1's gun clipping through terrain even when player 1 sees no clipping?
@beepbeep4697
@beepbeep4697 3 жыл бұрын
Can someone help with Attempt to call function 'set_text' in base 'null instance' on a null instance.
@calebpeters4473
@calebpeters4473 2 жыл бұрын
I love the tutorial but there is one problem. I didn’t use asset lab and created my own shotgun out of mesh instants but the collisions refused to work no matter what so my gun is clipping through geometry. Please help?
@evanarmont
@evanarmont 2 жыл бұрын
I don't know if I am too late to help, but I also made my own model. I created a new 3d scene in the folder where I have my guns, and called it "Shotgun". Under the spatial node, I added four mesh instances for the different parts, so it looks something like this: Spatial Barrel Magazine Forestock Receiver (the part that connects the handle to the barrel) Make sure that only the weapons layer is active under "visual instance" in all peices. Hope this helps
@CROXoDyLE
@CROXoDyLE Жыл бұрын
If anyone knows how to make the raycast follow the weapon please provide the code and or link to a resource for this. I would like the raycast to follow the weapon (instead of the main camera) so that when you shoot, the bullet hits a different spot when aimed in/out. The raycast from the main camera works but does not have the game feel I am going for. (If you aim in/out the raycast hits the same position) When you simply attach the raycast as a child of the weapon it kinda works BUT when it gets into the “weapon clipping” range it does not have the same position as the weapon rendered from the weapon camera. If anyone knows how to have the raycast follow the weapon when ads in/out WHILE STILL rendering the weapon on a different camera please help me out!! Much appreciated!
@jlebrech
@jlebrech 2 жыл бұрын
does the separate gun rendering accidentally show enemy guns?
@mm552
@mm552 Жыл бұрын
I've had the most bizzare issue whilst setting up the whole viewport thing, after I added the script to the viewport container's camera when I run the game I can only see the weapon and the sky with nothing else visible, all the things in the world are on Layer 1, the Player Camera is set to only 2 disabled, Viewport Camera to everything but 2, and the weapon is also 2.
@bity-bite
@bity-bite 4 жыл бұрын
12:00 You can save three lines of code by typing "onready var Camera: Camera = $"../Camera"?
@CodeWithTom
@CodeWithTom 4 жыл бұрын
You certainly can and that's a totally valid approach. I am leaning more towards exported NodePaths nowadays though as I think it makes your scripts more robust. Scripts can easily break if you change your scene heirarchy when using the $ syntax.
@tsk5328
@tsk5328 2 жыл бұрын
@@CodeWithTom sorry very silly question but Im very bad at organizing my projects and always end up moving things around later. if a parent script with the node path method is moved will the child scripts still function normally? (I'm scared of testig it as I have broken every project I've ever started by moving things and this tutorial project is currently my only working one)
@jonus5331
@jonus5331 3 жыл бұрын
Help, I have some problem with godot, despite my scirpts being right there are not working, when i try to run it nothing happens it is acting like there is no scrpits.
@Simplisti.
@Simplisti. 3 жыл бұрын
But uh, how do we make it so we can get killed by the AI?
@begamalls
@begamalls 2 жыл бұрын
Part 6 please
@panskibinski
@panskibinski 3 жыл бұрын
This tutorial alone is quite nice but as I fallow all parts now it messes with rendering switch from previous tutorials
@nathangames8744
@nathangames8744 3 жыл бұрын
How could you make the enemies kill you in the game
@lizipancake
@lizipancake 3 жыл бұрын
When I tried running the code after adding "raycast = get_node(raycast_path)" The debug view immediately crashes, opens Shotgun.gd, and the debugger outputs "Invalid set index 'cast_to' (on base: 'null instance') with value of type 'Vector3'." Any idea why?
@tsk5328
@tsk5328 2 жыл бұрын
Hi total noob here, but.... I think you forgot to remove shotgun.gd from the old weapon node? as shout gun script should not be active at this point in the vido. [edit] I also copied the shotgun script contents into my weapon script but just because I wanted to set range more easly during testing, still it might help.
@lizipancake
@lizipancake 2 жыл бұрын
@@tsk5328 Thank you, I will definitely look into this, I will probably edit with the results when I do afterwards
@JuanCarlos-qd1wk
@JuanCarlos-qd1wk 4 жыл бұрын
I love you are a crack
@firedogex
@firedogex 2 жыл бұрын
The weapons object download link
@apoorvpandey3D
@apoorvpandey3D 3 жыл бұрын
How to do weapon recoil?
@fabclippers2632
@fabclippers2632 3 жыл бұрын
yes yes
@fabclippers2632
@fabclippers2632 3 жыл бұрын
yes yes yes
@tsk5328
@tsk5328 2 жыл бұрын
Hi, total noob here, but I saw how they did it in the doom clone demo project avaleble from Godot assetlib, its basically an animation that plays after (or as part of) the fire animation, Earlier in this chat tom has a chat with someone about the power and drawbacks of the animation tree. here's a really cool video about ways to use animation tree kzbin.info/www/bejne/hYbZoZhve7Kegqs
@volayiwola15
@volayiwola15 2 жыл бұрын
wow
@cinomontague
@cinomontague 4 жыл бұрын
This vid was so bad ass
@unworthy.potato
@unworthy.potato 3 жыл бұрын
18:04
@KyaKarogeJaanKe54
@KyaKarogeJaanKe54 3 жыл бұрын
is using godot worth?
@froggames4922
@froggames4922 4 жыл бұрын
can you tell me how to make a multiplayer fps
@unworthy.potato
@unworthy.potato 3 жыл бұрын
Imagine what you could do with f5!
@matrixchronic8542
@matrixchronic8542 4 жыл бұрын
Could you try and make a battle royale tuturial on godot plz
@seemarajput779
@seemarajput779 4 жыл бұрын
plzz bro plzz plzz male a tutorial on eqiuping different wepons as you said in video plzz plzz this topic is rushing now, no one had made a video a lot of people need this including me plzz make thia video.... also, can pickup gun from ground ....
@masterox2
@masterox2 4 жыл бұрын
First😅
@alphastyx2
@alphastyx2 4 жыл бұрын
100th view
@matrixchronic8542
@matrixchronic8542 4 жыл бұрын
Free link to asset maker because my friend chalenged me to make a fps without paying for anything
@tsk5328
@tsk5328 2 жыл бұрын
did you find one? if you did, could you share a link? else try blender (3d) and Krita (2d)
FPS Character Controller in Godot - Make an FPS in Godot Part 1
33:29
Code with Tom
Рет қаралды 164 М.
How I Made My FPS Game Feel Better To Play | DEVLOG 0.37
6:11
Kyle Rhoads
Рет қаралды 180 М.
KINDNESS ALWAYS COME BACK
00:59
dednahype
Рет қаралды 161 МЛН
Самый Молодой Актёр Без Оскара 😂
00:13
Глеб Рандалайнен
Рет қаралды 4 МЛН
When You Get Ran Over By A Car...
00:15
Jojo Sim
Рет қаралды 34 МЛН
WHAT’S THAT?
00:27
Natan por Aí
Рет қаралды 12 МЛН
How To Aim Down Sights (ADS) In Godot
5:48
Garbaj
Рет қаралды 18 М.
3 Ways to Make a Sniper Scope in the Godot Game Engine!
14:38
Chaff Games
Рет қаралды 6 М.
Top 9 Games Made in Godot Voted By YOU - GOTY (Semifinals)
5:38
StayAtHomeDev
Рет қаралды 71 М.
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 695 М.
An Unusual Way to Fix This Common Problem in FPS Games
2:09
OBrooks
Рет қаралды 100 М.
Godot 4 3D Health Bar
15:23
Wide Arch Shark
Рет қаралды 2,5 М.
How To Optimize An Open World RPG -  Wrought Flesh Devlog 9
10:00
These awesome 3D games are made in Godot
5:40
MrElipteach
Рет қаралды 98 М.
The Weirdest Create Mod Addon
9:35
Dejojotheawsome
Рет қаралды 276 М.
How I Became a Sea of Thieves Developer
8:05
Zyger
Рет қаралды 192 М.
KINDNESS ALWAYS COME BACK
00:59
dednahype
Рет қаралды 161 МЛН