Hitscan Guns, Weapon Switching and Crosshairs - 3D Godot 4 FPS Tutorial

Поделиться
HTML-код
  • Опубликовано: 21 окт 2024
  • In this Godot 4.1 tutorial we work on creating a hitscan weapon for our zombie FPS game. The covered topics include shooting animations and mechanics, crosshairs, hitmarkers, bullet traces, hit particles, weapon switching, a simple weapon manager, and improved projectile guns. These mechanics can be used for many types of games, including FPS, horror, survival, RPG, etc.
    Support the channel: / legiongames
    The project is available on GitHub: github.com/Leg...
    Wishlist Game: store.steampow...
    Discord: / discord
    Itch: legiongames.it...
    Twitter: / legiongames1
    Instagram: / legiongames1
    Assets:
    Steampunk Rifle by chiwei - skfb.ly/oEruW
    Kenney Crosshair Pack - kenney.nl/asse...
    Muzzle Flashes - opengameart.or...
    Zombie model: www.mixamo.com/
    Ground texture by 0melapics: www.freepik.co...
    Kenney Graveyard Kit - www.kenney.nl/...
    Steampunk Rifle by Jake Sharp - poly.pizza/m/1...

Комментарии • 90

  • @sinewavey
    @sinewavey Год назад +11

    I just want to thank you for your intro tutorials. I followed some initially to get the idea of Godot's syntax in a project I felt a bit more aligned with after their documentation's. It helped me figure out some basic ideas and expand on them.
    Later on, I moved most things into a more composition based approach - but for the total beginner, this stuff was great!

  • @aryantzh2028
    @aryantzh2028 Год назад +10

    one of the greatest godot tutorial channel, please keep it up

  • @Szabbyhun
    @Szabbyhun Год назад +16

    Some suggestions for the future tutorials for this series: ladders; interactable objects(door, chest, lamps etc...); health bar, and player death; maybe a counter, that counts how many zombies have died.

    • @legiongames2400
      @legiongames2400  Год назад +6

      Oh yeah ladders would be really cool! I want to do some objectives for the level in the future so I think interactable objects will definitely be on the roster.

  • @tyranius
    @tyranius 11 месяцев назад +5

    Great tutorial so far. Just one thing, there's no need to use signals for the hit marker on the zombies. Since you're already checking for collision with an enemy group in your raycast, all you'd have to do is display the hit marker inside that condition.

  • @Godot-Bro
    @Godot-Bro Месяц назад +2

    Great video as usual! Would love to see more like it.
    Quick suggestion to others following along -- the crosshair I find easier to do it like this: make the TextureRect a child of a Control node, make the control node expand to screen size, and set the TextureRect to be centered. This accomplishes the same thing without needing any code and it updates with the viewport as if it changes size (windowed/full screen)
    NOTE: Any control nodes in your scene will BLOCK mouse activity by default, so go to any control nodes you have and under the "Mouse" setting, change the "Filter" option to "Ignore". Do this with ALL control nodes you have and you'll be able to move as usual.

    • @souvikdatta97
      @souvikdatta97 Месяц назад +1

      Thank you. This should be pinned.

    • @jjl2844
      @jjl2844 Месяц назад

      Quick question if you don't mind:
      I've followed your advice, but whenever I change the size of the viewport, the crosshair still lingers in its place. Any ideas why? thanks

    • @Godot-Bro
      @Godot-Bro Месяц назад

      @@jjl2844 If you followed what I said, the only thing I can think of that would prevent it from working is where it is in the hierarchy of nodes.
      Is the control node you made a child of something other than the base/camera node? If so I'd try bringing it to the highest level (making it a child of the main node or camera node) and make sure to set it to expand again just in case. You should see it expand to the full viewport size in the editor.
      Hope that helps!

  • @danteonw
    @danteonw Год назад +17

    Just a suggestion but work on how you edit the videos, making no pause between different speeches make this video pain to watch/listen. I try setting it at 0.75 and even 0.5 speed but it doesn’t help a lot.

  • @barney10240
    @barney10240 5 месяцев назад +14

    In the UI Crosshair Segment, if you cannot move your mouse, go to the UI layer and look at the Inspector. Find "Mouse" and look for "Filter." Then change "Stop" to "Ignore." Your mouse should be working again now.

  • @imrigly
    @imrigly Год назад +2

    Awesome tutorial! Thanks!

  • @aryanarayanan4680
    @aryanarayanan4680 Год назад +3

    the tutorial is really good but i would prefer it if a lot of things are simplified, such as the bullet trail using particles, and killing the zombie internally within script without any world script, etc. and i would also like to see a multiplayer tutorial. This is really amazing, only good tutorial for gun shooting in godot 4, the other creators are not yet updated to use this engine in tutorials.

  • @paulchen9145
    @paulchen9145 Год назад +3

    Great tutorial! One bad practice with these video though which I would encourage people against is putting all the UI on the world/map level. Instead move your crosshair and hitRect into your player instead, so that it is actually reusable and completely independent of the map-scene...

    • @legiongames2400
      @legiongames2400  11 месяцев назад +1

      Completely agree, some bad decisions were made in this tutorial.

  • @Ookami-g4v
    @Ookami-g4v Год назад +2

    Awesome content.
    Please make a tutorial on how to make terrains, mountains and uneven landscapes.

    • @legiongames2400
      @legiongames2400  Год назад +1

      Thank you! :) I've been trying to figure out an easy way to do it in Godot 4 since a lot of the terrain plugins are not updated from Godot 3 just yet, but I'm definitely doing that in the near future!

  • @leohellstrom221
    @leohellstrom221 Год назад

    Thank you! Very informing and good vidios. Better then most RUclipsrs!

    • @legiongames2400
      @legiongames2400  Год назад

      I'm glad you're enjoying the videos, thank you very much! :)

  • @IceWolve67
    @IceWolve67 8 месяцев назад

    Your tutorils are amazing, and clear, my only points would be to be a little slower (granted youtube allows to adjust speed), but men, I'd definitly buy a full fps course if you ever do one ! :D

  • @uwerst
    @uwerst Год назад +1

    Good tutorial. Thank

  • @JohnCanCode
    @JohnCanCode Год назад +1

    Solid tutorials recently! Would love to see this and the char controller in a multiplayer scene; after all who doesn't like blasting zombies with your mates. :)

    • @legiongames2400
      @legiongames2400  Год назад +1

      Yeah I'd love to do a multiplayer tutorial eventually as well, I'm looking into it atm but we'll see how viable it is to refactor this game for multiplayer / making a new one from scratch.

    • @Yoni123
      @Yoni123 Год назад

      Will you continue this FPS series? Maybe a melee attack? @@legiongames2400

  • @coltr1
    @coltr1 5 месяцев назад

    Have you thought about making a melee combat tutorial? It would be great to have a solid melee guide that feels something like Risk of Rain 2's melee combat.

  • @TNoire52
    @TNoire52 3 месяца назад

    Great tutorial! Just had one question. Why do many godot tutorials on the weapon system(including yours) have the weapons already on the player node. Why not instantiate them when you need them. Is there a specific reason for this that I should learn about? Thank you for the great videos. Keep up the good work!

  • @joaogarcia3786
    @joaogarcia3786 Год назад

    awesome work! keep it up!

  • @traumwelt1975
    @traumwelt1975 4 месяца назад

    this serie is FANTASTIC !!! Thanks a lot for doing it ! HOwever, it would be really cool imo if we had a kind o fhealth system for the player... XD, right now there is not many stakes or risks is there ? XD

  • @Retro_Mech
    @Retro_Mech Год назад +1

    good tutorial man, btw by any chances can you make a tutorial for aiming down sight in godot i was new to it especially godot 4 so it would help me alot if you do.

  • @kernball8059
    @kernball8059 27 дней назад

    Just in case anyone had the same problem as me, if after you create the crosshair your mouse stops turning your character, what I did to fix it is inside of the crosshair ui element there is a section called "Mouse". Click on that and inside you should see a "Filter" option. Mine was set to "pass" but once i set it to "ignore" my mouse was working again.

  • @ElGhost-p6t
    @ElGhost-p6t 6 месяцев назад +2

    Dude, your tutorial is great, but when I press play, the weapon always appears below the camera, I looked for something wrong in the codes and animations but everything was fine. Can you help me?

    • @legiongames2400
      @legiongames2400  6 месяцев назад +1

      I'm not sure what's going on there, you double checked that when you preview the camera in the editor the weapon is visible?

    • @ElGhost-p6t
      @ElGhost-p6t 6 месяцев назад +1

      @@legiongames2400 yes, but it is only under the camera

  • @bonddang9550
    @bonddang9550 Год назад

    Thank you so much! I love your tutorial, can you make one about infinite map terrain generation, sound design(guns sound reload and animation, footstep and melee sound) and cover about realism? Like enemies with guns? Or footsteps? Or even inventory for a looter shooter(I don't think there is a single tutorial on youtube for it)? I am sorry if I ask too much. But I think if you can cover these topics in your video, I think it would be really awesome and a lot of people would find it helpful.
    That is just food for thoughts though:
    These are some really great ideas you can cover and as a beginner your video is really helpful and awesome! I know making these video are tough especially editing take times and writing script for the video is not very easy.

    • @legiongames2400
      @legiongames2400  Год назад +1

      Thank you for watching and the ideas! I don't think I'm going to do infinite map generation for this one, but sound design and ranged enemies are definitely on the list. Item pickups eventually as well, but for a robust looter shooter system you may want to look into some RPG game tutorials because they have very the same type of inventory systems that looter shooters do.

  • @apoorvpandey3D
    @apoorvpandey3D Год назад +1

    These are awesome. Please also do a arkham style free flow combat system if possible❤❤

    • @legiongames2400
      @legiongames2400  Год назад +3

      Thank you friend! :) That's way more difficult to do but hopefully I'll get around to it sometime!

  • @cyb-m1g
    @cyb-m1g 4 месяца назад +3

    wish this tutorial was slower

  • @marlinejoshi4568
    @marlinejoshi4568 3 месяца назад

    I'm new in the 3D game and i followed your tutorials and i loved it. But i wanted to ask you if I want to add score system and show damage of enemies where do i have to add. Can you give me slight hint it would be a great help!!!

  • @catjox_45
    @catjox_45 Год назад

    Awesome!❤

  • @DJ-MKpL
    @DJ-MKpL Год назад +1

    thanks for these materials but I have a request if you could insert the next part of the system of life and death pleats

    • @legiongames2400
      @legiongames2400  Год назад +1

      Thank you for watching! :) Yeah definitely need to include that haha :D

  • @THEDEVBOIS
    @THEDEVBOIS 5 месяцев назад

    if I have multiple animations how do i make it so that the left hand stays locked with the weapon? i already know how to lock one hand. the problem is when i play an animation one hand is locked in good but the animation doesn’t coincide with the other hand. so it doesnt look good. im doing a third person game. and if i go into blender and parent the weapon to one hand, export it into the game it doesnt stay locked. it floats free so im back to square one

  • @shardadevi6137
    @shardadevi6137 Год назад

    I want your game because your game amazing

  • @sunnyxyzt1
    @sunnyxyzt1 Год назад

    Great tutorial. I think it will be nice to add gun recoil to hitscan weapon, I can think of adding some randomness on each shot, but the gun in csgo seems to have pattern for the gun recoil, so the players can learn from the pattern, still thinking of how to adding fix pattern gun recoil to the shooting

    • @legiongames2400
      @legiongames2400  Год назад

      Yeah recoil is definitely necessary there because otherwise it just feels like a lil laser gun, vid was just very long already. Thank you for watching! :)

  • @bear_m-117
    @bear_m-117 Год назад

    Really good video. I have a question: will there be weapon reload and pick up?

    • @legiongames2400
      @legiongames2400  Год назад +2

      Definitely going to be weapon reload and pickup, will try to get around to it asap. Thank you for watching!

    • @bear_m-117
      @bear_m-117 Год назад

      Cool

  • @chromeWarriorXIII
    @chromeWarriorXIII Год назад

    Thanks for these great tutorials! They've been really helping me get back into the groove of using Godot. I'm having a weird problem with my bullet trails though: No matter what I use for the "pos1" in both the "instance.init(barrel.global_position, aim_ray.get_collision_point())" or "instance.init(barrel.global_position, aim_ray_end.global_position)", whether it's the barrel of the gun or a different point on my character, the trails always start off spawned a bit above my player's head. I even tried changing it to use the aim_ray position as pos1 so it would start in the center of my camera but it still spawns above my head. The ending position (pos2) also seem off. Even when they stop because they hit something, they're usually floating a bit above whatever they're colliding with (like stopping because of a block, even though it doesn't look like they're colliding). Any ideas what could cause this?

    • @legiongames2400
      @legiongames2400  Год назад +1

      Hey thank you very much for watching! I'd assume the problem is somewhere with the global positioning of the things around the level. The code relies on global positions of both the gun barrel and collision point and if you add the trail as the child of something that has any position transforms applied that would mess up how the trail appears. So double check that your map or whatever you're adding the trail to is positioned at 0, 0, 0 coordinates.

    • @chromeWarriorXIII
      @chromeWarriorXIII Год назад

      @@legiongames2400 Thank you for the reply! I'll have to double check everything when I get home, but I think I might have my character's starting position as something like 0, 2, 0 so that would probably be the cause!

    • @chromeWarriorXIII
      @chromeWarriorXIII Год назад

      @@legiongames2400 Just got home and double checked and yup, 0, 2, 0. Moved the character to 0, 0, 0 and shifted the test level's geometry down a bit instead and everything works perfectly now! Thank you so much for the help!

  • @udochukwuPaul-chukuka
    @udochukwuPaul-chukuka 6 месяцев назад

    thanks man can you add 3rd person tutorials please i really like your videos

    • @legiongames2400
      @legiongames2400  6 месяцев назад

      Thank you friend! What kind of 3d game were you looking to make?

    • @udochukwuPaul-chukuka
      @udochukwuPaul-chukuka 2 месяца назад

      @@legiongames2400 i am trying to make a third person survival game like last of us
      i am sorry for the long wait just finished school please can u make tutorial on it please

  • @raminkuntopolku8636
    @raminkuntopolku8636 5 месяцев назад +1

    do you not review your videos before posting? I feel like everything goes too fast and i don't have time to look at what you did before you've already hopped on to the next thing

  • @1vallgaming404
    @1vallgaming404 Год назад

    I've been using Godot 4.1 and it launch me off the map as soon as I run. It was a quick noclip off the map without touching the keybinds

    • @legiongames2400
      @legiongames2400  Год назад

      Haven't really ran into this problem before, what code are you using for movement?

    • @1vallgaming404
      @1vallgaming404 Год назад

      ​@@legiongames2400It was CharacterBody3D code

  • @specter6109
    @specter6109 Год назад

    great content! do you have a tutorial on third person shooters?

  • @kritikalskillz5437
    @kritikalskillz5437 2 месяца назад

    honestly could do without the "bullet trails" as they literally just look like debug lines to me but other than that fantastic work, subbed

  • @Yoni123
    @Yoni123 Год назад

    CAn you add more enemies and some RPG elements like quests, inventory and stats

    • @Yoni123
      @Yoni123 11 месяцев назад

      And a melee weapon?

  • @dyadyablichzhoski
    @dyadyablichzhoski Месяц назад

    i decided to download the project and see how it works and the zombs were invisible

  • @da_cat
    @da_cat 2 месяца назад

    I almost fell asleep watchng this

  • @Kris29919
    @Kris29919 2 месяца назад

    Can you say how make shotgun?

  • @TheDuasun
    @TheDuasun Год назад

    Well, after extensively searching on Internet, no one made a inteligent enemies in Godot... Yet... Enemies that dodge bullets, hide behind obstacles... Is it so hard to do?

  • @Nomad5oul
    @Nomad5oul Год назад

    Please can you do a tutorial for an enemy AI that shoots at the player when they have line of sight

    • @legiongames2400
      @legiongames2400  Год назад

      Thank you for watching! :) I have a couple of other video ideas lined up at the moment but ranged enemies are next in this series.

  • @daniyarm2922
    @daniyarm2922 Год назад

    How to add a hit animation. Well, a few random attacks?

    • @legiongames2400
      @legiongames2400  11 месяцев назад

      Have multiple attack animations in the tree and choose which one you play depending on a generated random number maybe?

    • @daniyarm2922
      @daniyarm2922 11 месяцев назад

      @@legiongames2400 No, it's better to just shoot at the enemy. And he will have a punch animation as if he is pushing away. HIT animation.

  • @arielgimenez_95
    @arielgimenez_95 11 месяцев назад

    Export the project and upload it to itchio to test it!

  • @theblackgorilla6334
    @theblackgorilla6334 Год назад

    When I move the gun for the animations it's position resets in the main scene cause it to glitch out, does anyone know how to help

  • @trays1377
    @trays1377 Год назад

    Please can you crete playlist FPS Tutorial?

  • @binoice1301
    @binoice1301 6 месяцев назад

    please add sound to you game