SHOOTING with BULLETS + CUSTOM PROJECTILES || Unity 3D Tutorial (#1)

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 พ.ย. 2024

ความคิดเห็น • 423

  • @GodBeast_FireOnHell
    @GodBeast_FireOnHell ปีที่แล้ว +5

    I just start making my first game and watched so many tutorials to solve my issues but none of them helped, then I see your channel and it have every single video I need, love you work sir

  • @non-shockingtopics7563
    @non-shockingtopics7563 2 ปีที่แล้ว +41

    I know it's been a while since this video came out so apologies if you've already fixed/moved on from this in the time since, but I noticed some problems with the way your spread is calculated and have personally fixed them to share with you and anyone passing by.
    1. Your spread calculates purely based on the target point's position, it doesn't get bigger the further away it is, meaning stuff like shotguns would be super OP and accurate at very far distances (which is fine if this was intended, but it didn't work for my project). I fixed this by always setting the target point to a constant position in front of the gun muzzle (5 in my case).
    Use this:
    Vector3 targetPoint = ray.GetPoint(5f);
    Instead of the raycast if else block to determine the hit point.
    2. Your spread also calculates in only the x and y directions, meaning if I face the x direction there is no horizontal bullet movement because there's no z spread.
    Just add another Random.Range for the z direction in directionWithSpread for this to be solved:
    float x = Random.Range(-spread, spread);
    float y = Random.Range(-spread, spread);
    float z = Random.Range(-spread, spread);
    directionWithSpread = directionWithoutSpread + new Vector3(x, y, z);
    Hope this helps someone!

    • @mutatedsun6047
      @mutatedsun6047 2 ปีที่แล้ว +1

      Thanks my dude

    • @stephenmurya
      @stephenmurya 2 ปีที่แล้ว +2

      Wow this really helped fixed some issues I was having with the code. I'm trying to implement this on a gun mounted on a car (sort of how a tank would function.) The bullet instantiates at the gun tip, but it goes in the direction the car is facing, instead of where the gun is facing. Could you help me out with it?

    • @あれくす
      @あれくす ปีที่แล้ว +2

      @@stephenmurya use the gun's transform forward as the forward direction for the projectile? apparently you are using the vehicles transform forward direction...

    • @orangeplumbob
      @orangeplumbob ปีที่แล้ว

      To add to this instead of giving the targetPoint a hard number, give it a variable like spreadDistance so that each gun could have a different spread difference. A shotgun with a close distance, where a sniper would have a farther distance.

    • @Eastyoffutt
      @Eastyoffutt ปีที่แล้ว

      It made me bullets not shoot through the center of the screen though

  • @davegamedevelopment
    @davegamedevelopment  4 ปีที่แล้ว +9

    I forgot to mention the DOWNLOAD LINKS in the video :D
    ➤DOWNLOAD THE SCRIPT: www.dropbox.com/s/xpjbpi597akdqku/ProjectileGunTutorial.cs?dl=0
    ➤Download the whole PROJECT (channel #free-code-dave): discord.gg/5S3bBBq
    If you need help with any of the code shown, just visit the "coding-help" channel on my discord server :D
    Also you can find many more movement tutorials on my channel in the "Tutorials!" playlist - I really hope they help you on your further GameDev journey!
    And in case you're interested in getting access to my full RANGED COMBAT LAB, with which you can create pretty much any ranged ability/weapon you can think of, check out the trailer:
    🏹 RcLab Trailer: th-cam.com/video/j2YplilHjCA/w-d-xo.html
    Thanks so much for watching, hope this tutorial has helped you!
    Thank you so much for watching! If you have any questions just write a comment, I'll answer as many as I can! :D

    • @jlgaming9997
      @jlgaming9997 4 ปีที่แล้ว +1

      Hippity hoppity your code is now my propery
      Jk not actually

    • @sonoakneely9574
      @sonoakneely9574 4 หลายเดือนก่อน

      is the script the first script you start with

  • @divyanshpathak2506
    @divyanshpathak2506 4 ปีที่แล้ว +56

    Haha Just at the perfect time...I am making an fps game and really wanted a nice easy custom projectile shooting tutorial and their we go.Dave your game development and tutorials are awesome.I am sure that you will hit 1 million really fast(Like really fast)

    • @davegamedevelopment
      @davegamedevelopment  4 ปีที่แล้ว +4

      Haha, thanks a lot man! Glad I could help! :D

    • @aaronscreations947
      @aaronscreations947 2 ปีที่แล้ว +1

      @@ebsku now 2 but still deserves it

    • @randoavis2
      @randoavis2 ปีที่แล้ว +1

      he should really have more subcribers

    • @sonoakneely9574
      @sonoakneely9574 4 หลายเดือนก่อน

      sry but its 2024 with 4k likes sry to break it too you

  • @crazycraftcreations6625
    @crazycraftcreations6625 4 ปีที่แล้ว +103

    You are the Future Barckeys He left :(

    • @jlgaming9997
      @jlgaming9997 4 ปีที่แล้ว +2

      @James Thwaites you need to give him time he is a human and is evolving his video instead of criticizing gove him suggestions im sure he will improve

    • @jlgaming9997
      @jlgaming9997 4 ปีที่แล้ว +1

      @James Thwaites oh yeah and he isnt overcomplicating the script he is making it download friendly and adding extra bools that u would not need .
      for example if u want a object to go to point a from the available point a and b
      then u will require the tutorial for a but other people would want to go to b
      would need a tutorial for b
      he is making is code compatiable for both a and b
      ok just realised i typed too much here lol

    • @not_herobrine3752
      @not_herobrine3752 3 ปีที่แล้ว +2

      @James Thwaites guess these tutorials are for people who have a basic understanding of unity c# and want to learn more

    • @austinwhiteted8231
      @austinwhiteted8231 3 ปีที่แล้ว +1

      @@not_herobrine3752 yee, but remember c# gets easy to remember after some time. (I'm 16 and making my first fps game. its a mixture of ray cast and physical bullets) it just depends on how active you are too.

    • @adhochero6619
      @adhochero6619 3 ปีที่แล้ว

      @James Thwaites I think these videos are great, brackes videos are still up for beginners, but they are to basic for me these are at a great pace for those that already kinda know what they are doing and can watch this real quick and get good ideas on how to set some of this stuff up better.

  • @GlasTaibhse
    @GlasTaibhse 9 หลายเดือนก่อน +2

    your vids are great, thanks for always uploading quality tutorials and content! always to the point, and the foundation you provide in your vids is super easy to expand upon. thank you!

    • @Blaxe75
      @Blaxe75 9 หลายเดือนก่อน

      fr tho also I cant believe you juste posted a comment

  • @ArranAsh
    @ArranAsh 4 ปีที่แล้ว +8

    Although the video was fast I paused it at times to read up on what each bit of code did and why it needs such parameters. Overall it's been really useful to start off with and I thank you a lot for making this video!

    • @thecrispyacorn
      @thecrispyacorn 3 ปีที่แล้ว

      it was super fast, i was just loading up my project when he started typing.

    • @Detective_depther
      @Detective_depther 6 หลายเดือนก่อน

      ​​@@thecrispyacorn my project was loading while i watched this video several times, got married, got kids, got old, preached the tales of my great adventure to my grandchildren, reincarnated, and came back to my project still loading

    • @thecrispyacorn
      @thecrispyacorn 6 หลายเดือนก่อน

      @@Detective_deptherbro 😭

  • @MrHerrJonsson
    @MrHerrJonsson 4 ปีที่แล้ว +3

    Great tutorial mate and you solved my greatest issue, which is to make the projectile travel towards the center of the screen. Much appreciated!

    • @davegamedevelopment
      @davegamedevelopment  4 ปีที่แล้ว +2

      Yeah indeed, that's a bit tricky :D Glad I could help you! :D

  • @burgerfanman
    @burgerfanman 2 ปีที่แล้ว +22

    Wow this gives me such amazing Brackeys vibes :)
    I never knew that you could simply state a bool or a !bool inside an if query, I always thought you had write bool = true or bool = false.

    • @Tacky_I
      @Tacky_I 2 ปีที่แล้ว

      lol i was just watching one of Brackeys first person tutorials, now i wanted to make weapons.

  • @HOMOLUDENSJM
    @HOMOLUDENSJM 3 ปีที่แล้ว +1

    The next Brackeys. LONG LIVE THE KING

  • @stevenjuana3920
    @stevenjuana3920 4 ปีที่แล้ว +12

    Great video! Can't wait for the rest of the series!

    • @davegamedevelopment
      @davegamedevelopment  4 ปีที่แล้ว +3

      Thanks! The second part should be published this week :D (Hopefully... ^^)

    • @sonoakneely9574
      @sonoakneely9574 4 หลายเดือนก่อน

      theres only 2 parts

  • @nikhilchhetri900
    @nikhilchhetri900 3 ปีที่แล้ว

    Searched a lot for moving a prefab in the raycast direction, nothing solved my issue....... went through a lot of blogs and videos....... and finally I found this tutorial......thanks a lot for this. This is the best way I've come through to solve my shooting issues.

    • @bytefloww
      @bytefloww 2 ปีที่แล้ว +1

      yeah......................................... its..................................... the................................. best..................................... one................................................ :)........................................

  • @Intro2Love
    @Intro2Love 3 ปีที่แล้ว +1

    Sticky bullets sounds awesome
    😎👍

  • @erentst
    @erentst 2 ปีที่แล้ว

    im just so greatful Dave exists.

  • @stevethepirate
    @stevethepirate 8 หลายเดือนก่อน

    awesome! thank you! a bit tricky at spots but just because i haven't tried to do it before. i still followed it and understand it well enough to try it myself now.

  • @Intro2Love
    @Intro2Love 3 ปีที่แล้ว +3

    Sticky bullets would be cool😎
    Like the plasma grenades in HALO😁👍

  • @ebrahimmomin7518
    @ebrahimmomin7518 2 ปีที่แล้ว +4

    If your making a FPS game, he also has a video on first person player movement which helped me alot

  • @a3dadventure79
    @a3dadventure79 11 หลายเดือนก่อน

    thanks for your work. you're vids are a great resource for those learning Unity!

  • @SacWebDeveloper
    @SacWebDeveloper 10 หลายเดือนก่อน +1

    Awesome video, but one little thing. A shotgun does not shoot multiple bullets per trigger press, it shoots a shotgun shell which spreads little tiny balls all over the place. I think you don't need to keep multiplying and dividing the number, but just spawn that many each time you shoot.

  • @ScoutsStudios
    @ScoutsStudios 4 ปีที่แล้ว

    You are gods gift to noobs and professionals.

  • @bumba5727
    @bumba5727 4 ปีที่แล้ว +2

    Great video! i really liked how you showed us how to set the gun up! thanks!

  • @youton_gaming
    @youton_gaming 2 ปีที่แล้ว +1

    why are you only at 14k you deserve more

  • @satobi46
    @satobi46 2 ปีที่แล้ว +1

    Thank you so much Bra-, I mean Dave.

  • @firecreeper9059
    @firecreeper9059 8 หลายเดือนก่อน +1

    "You don't want any upward force on your bullets"
    Me who will create a gun with bullets similar to a boomerang :b

  • @ebrahimmomin7518
    @ebrahimmomin7518 2 ปีที่แล้ว +2

    You earned a subscriber

  • @g5haco
    @g5haco 4 ปีที่แล้ว +4

    your tutorials make me go
    Y E S

    • @davegamedevelopment
      @davegamedevelopment  4 ปีที่แล้ว +2

      Thanks man :D

    • @g5haco
      @g5haco 4 ปีที่แล้ว

      @@davegamedevelopment hi dave can you pls make your wall run tutorial simpler and explain better its good and all that but its not that clear on the code and can you fix the project files it wont let me download it thanks :P

  • @smbiplob9476
    @smbiplob9476 2 ปีที่แล้ว +1

    Amazing tutorial! You are awesome !!!! Thankyou

  • @sergibonell5400
    @sergibonell5400 2 ปีที่แล้ว +4

    I tried implementing this but I found a problem, if the Raycast hit is behind the firing point (or really close to it) the bullet won't shoot forward, and will shoot sideways instead. Do you know how could I fix this? I've been thinking about itbut I have no idea.

  • @WilliamDoesStuff
    @WilliamDoesStuff 2 ปีที่แล้ว

    Thanks, I will use this in a VR game

  • @plumburger7010
    @plumburger7010 2 ปีที่แล้ว +2

    Got a random error, would be really helpful if you could answer!!
    Assets\Scripts\ProjectileGun.cs(67,26): error CS1061: 'Camera' does not contain a definition for 'ViewportPointToRay' and no accessible extension method 'ViewportPointToRay' accepting a first argument of type 'Camera' could be found (are you missing a using directive or an assembly reference?)

    • @andreaslarsson1279
      @andreaslarsson1279 ปีที่แล้ว

      I know its late but you probably have another scrips called "Camera"

  • @BluePhantomGames
    @BluePhantomGames 3 ปีที่แล้ว +5

    I have a trick:
    but u will need to play test on full screen mode.
    and in ur look script at start method:
    U have to write
    Cursor.lockmode = CursorLockMode.locked;
    This will make the cursor position on the center
    (Press esc key to able to move cursor)
    at the part, calculation of distance between point and player
    U can use mouse position instead of 0.5
    u can do this by:
    create a variable
    Vector3 mousePos = Input.mousePosition;
    Ray ray = cam.ViewportPointToRay(mousePos);

  • @JustMatt221-w6x
    @JustMatt221-w6x 9 หลายเดือนก่อน +1

    New to Unity and really enjoyed this tutorial. Everything is working great except my muzzle flash will start at the attack point but if my character is moving or if I'm looking around the muzzle flash will stay at the point where it was created. I've been working on it for a few hours to try and get the muzzle flash to move with the attack point but no matter what it will only stay at the point it was created. Any possible solutions I should try to explore?

    • @JustMatt221-w6x
      @JustMatt221-w6x 9 หลายเดือนก่อน +1

      Solved my own issue. In case anyone else gets this, you need to add a fourth argument to Instantiate so that the muzzle flash that is created will transform with the attack point.

    • @shark_byte_clips
      @shark_byte_clips 6 หลายเดือนก่อน

      @@JustMatt221-w6x Im having this issue, what does that fourth argument looklike? EDIT: I did attackPoint.transform.parent for the fourth argument and it seems to work :3

  • @cem8015
    @cem8015 2 ปีที่แล้ว

    thank you so much! this tutorial has helped me a lot

  • @perrylets
    @perrylets 4 ปีที่แล้ว +4

    Can you make a tutorial about movement in a game like Karlson, Dani script is from a past version of unity, also can you make a tutorial of the make of levels.

    • @davegamedevelopment
      @davegamedevelopment  4 ปีที่แล้ว +3

      PerryLets Yeah maybe I‘ll do a movement tutorial series in the future, but for now could join my discord and download the project file used in this video. There you‘ll find a movement script based on Dani‘s (but with a lot of other stuff added) :D

    • @perrylets
      @perrylets 4 ปีที่แล้ว

      @@davegamedevelopment THX

  • @suxpop2171
    @suxpop2171 4 ปีที่แล้ว +2

    Great video, brother! :)

    • @pumpkii
      @pumpkii 3 ปีที่แล้ว +1

      OH MY GOSH AM I THE ONLY ONE WHO REALIZES THAT HE'S JUST COPY AND PASTING BRACKEYS VIDEOS

    • @miguelanterodevsgaming6529
      @miguelanterodevsgaming6529 3 ปีที่แล้ว

      @@pumpkii not all but ye he's kinda doin that

  • @prameelarani8005
    @prameelarani8005 4 ปีที่แล้ว +1

    You are brackeys thanks mate

  • @BecksCraft
    @BecksCraft 3 ปีที่แล้ว

    Keep Going man. Love it!

  • @Ocer.
    @Ocer. 4 ปีที่แล้ว +15

    Hey, Im here from the Enemy AI tutorial, how do I combind this script with the enemy AI one?

    • @zypherone
      @zypherone 2 ปีที่แล้ว +1

      I just instantiate a bullet with the direction that they are facing when they are in attack range. Just keep in mind there’s a big that leads to them shooting above the player but you’ll be able to fix it I’m sure

    • @docgraal485
      @docgraal485 ปีที่แล้ว

      @@zypherone how do I delete the projectiles after they have been shot

  • @SharkyVR
    @SharkyVR 2 ปีที่แล้ว +2

    Is there any way to make the bullets do damage to an AI?

  • @AldinCraft
    @AldinCraft 4 ปีที่แล้ว +4

    Great tutorial :)

  • @thedev6172
    @thedev6172 4 ปีที่แล้ว +2

    Love your videos...plz make a tutorial on enemy ai with anims

    • @davegamedevelopment
      @davegamedevelopment  4 ปีที่แล้ว +2

      I'll definitely make a tutorial on fps enemy ai! Just give me a few weeks, currently also working on other videos :D

  • @mykytamolodtsov8734
    @mykytamolodtsov8734 4 ปีที่แล้ว +1

    Great tutorial, ty, man, I'm lucky I found it ;)

  • @clarkmeyer7211
    @clarkmeyer7211 3 ปีที่แล้ว

    wow this looks amazing. Joining your discord. I hope you don't mind me asking questions about this because I have a procedural weapon generator that instantiates guns rather than them being placed in the world manually. At the moment I don't see anything that could be tricky to get to work but you never know haha.

  • @oblo4952
    @oblo4952 4 ปีที่แล้ว +5

    when I used the script and followed all the directions, when I shot it did nothing but create a bullet that didn't move...
    I don't know what I am doing wrong

    • @davegamedevelopment
      @davegamedevelopment  4 ปีที่แล้ว +3

      Does your bullet have a rigidbody and did you set the forward and upward force to something like 50 and 10? :D
      Remember you can also download the whole project over my discord server and see how everything is set up :D
      (And there's a second part of the series)

    • @oblo4952
      @oblo4952 4 ปีที่แล้ว +1

      @@davegamedevelopment k thanks

    • @juliuslukosevicius9360
      @juliuslukosevicius9360 3 ปีที่แล้ว

      Did you add force to it? (if you didnt then go watch 5 : 13 there he adds force to the bullet)

  • @TheBagOfGames
    @TheBagOfGames ปีที่แล้ว +1

    thanks :)

  • @LionDev
    @LionDev 4 ปีที่แล้ว +4

    Yo this was absolutely interesting because I'll maybe make a fps after my RPG where this will be incredible helpful thanks man

  • @majitelpravdy9106
    @majitelpravdy9106 2 ปีที่แล้ว +1

    Great tutorial!!!!!! keep going

  • @rabi0ne
    @rabi0ne 4 ปีที่แล้ว +1

    I mean... Your videos combined to Brackey's will make us creat the next AAA Game of all times!!
    I have a question tho; how to change MyInput method to use buttons instead of keys?? (i know how to use OnClick but that's it... it wont reconize the button hold.

    • @davegamedevelopment
      @davegamedevelopment  4 ปีที่แล้ว +1

      Thanks a lot! Best of luck with your game :D
      For detecting button holds I would use the "Event trigger" component, then set it to PointerDown (that's the start of the hold) and another eventTrigger to PointerUp (end of the button hold)
      Hope that helps :D

  • @durgam_sumerian7815
    @durgam_sumerian7815 4 ปีที่แล้ว

    Hi man and thanks for the great tutorial but, I can find a tutorial in your list channel about the 3d movement (Top, FPS..etc), maybe because I'm new in your channel. I know there are many tutorials for such subjects but I like to see your codes about it because it pretty cleared and work just great.

  • @juliuslukosevicius9360
    @juliuslukosevicius9360 3 ปีที่แล้ว

    this mad man made a video on how to make an entire shooting system in 9 Minutes
    it fast tho

  • @aimlezz8855
    @aimlezz8855 2 ปีที่แล้ว

    Good stuff. Thanks!

  • @cardboardtoaster2169
    @cardboardtoaster2169 2 ปีที่แล้ว +1

    Either my shooting code is glitched or there's something wrong in my scene because whenever I shoot, the bullets go up instead of straight ahead

  • @TheBankruptBuilder
    @TheBankruptBuilder 2 ปีที่แล้ว

    the muzzle flash is not showing but it is in did spawning, interesting.
    Edit: it looks like i forgot to turn on "play on awake", now the problem is solved, splendid

  • @kristijandrgestin863
    @kristijandrgestin863 4 ปีที่แล้ว +1

    izvrsno nice work bro

  • @iizlyfeii798
    @iizlyfeii798 2 ปีที่แล้ว +3

    Great video! Only thing I changed was I didn't divide by bullets per tap. I feel like in most games I see, if it's a 3 round burst it'll just tick down 3 bullets after each shot.

  • @l.halawani
    @l.halawani 7 หลายเดือนก่อน

    Shouldn't we normalize the direction before applying spread?

  • @mhze
    @mhze 2 ปีที่แล้ว +1

    script link is not working
    plz fix it

  • @xdxdxd6599
    @xdxdxd6599 3 ปีที่แล้ว +3

    Awesome tutorial but got a little problem here, when I shoot the bullet, the bullet doesn't go to the center but instead it goes a bit left from the center. How can I make this go directly to the center?

  • @darshilpatel4322
    @darshilpatel4322 3 ปีที่แล้ว

    How to type like u man, amazing skills, give some tips for typing . btw amazing video

  • @bennydaboy6984
    @bennydaboy6984 4 ปีที่แล้ว +2

    Really useful, But could you make the bullets disappear and use when they collide with something, This would be very helpful thanks.

    • @davegamedevelopment
      @davegamedevelopment  4 ปีที่แล้ว +2

      Sure, just have a look at the second part of the series, there I explained how to make the explosion etc. :D

    • @bennydaboy6984
      @bennydaboy6984 4 ปีที่แล้ว

      @@davegamedevelopment Thanks this will help a lot + U got a new subscriber :0

    • @Tacky_I
      @Tacky_I 2 ปีที่แล้ว

      @@bennydaboy6984 Wow, 2 favorited comments in one, amazing!

  • @aminmkyt4191
    @aminmkyt4191 3 ปีที่แล้ว

    Hi, I loved the outcome but the thing that I don't like about your tutorials is that you make all the variables at the start and I can't understand what is happening. Like, at first you'll make the shooting and fire rate, then the spread and reloading and the other stuff. So it'll be better to make the variables when you need them.
    But again, great tutorial :)

  • @umutbozkurt6860
    @umutbozkurt6860 3 ปีที่แล้ว

    You are amazing!!

  • @artdays9561
    @artdays9561 2 ปีที่แล้ว

    AMAZING!!! But for some reason the bullets dont go to where my crosshair is?

  • @thanhatchau5852
    @thanhatchau5852 9 หลายเดือนก่อน

    Thank you very much

  • @justinklasnic2923
    @justinklasnic2923 4 ปีที่แล้ว +2

    Perfect!

  • @travel2120
    @travel2120 หลายเดือนก่อน

    good shit man :)

  • @AquariaAiryglyphia
    @AquariaAiryglyphia 2 ปีที่แล้ว +1

    PLEASE REUPLOAD FULL PROJECT... IN THE DISCORD, THE DOWNLOAD LINK FOR THIS GUNS & BULLETS PROJECT IS ACTUALLY THE PICK UP / DROP OBJECTS PROJECT.

  • @lindal93
    @lindal93 4 ปีที่แล้ว +3

    Great lesson, thanks!
    I want to ask how you can make the whistle of a flying physical bullet? I tried to make the bullet an audio source, but the whistle of the bullet is extremely unstable for some reason

    • @davegamedevelopment
      @davegamedevelopment  4 ปีที่แล้ว +5

      Seems like Unity can't handle the audio stuff on such fast objects.
      You could make an audio manager that always checks if a bullet entered a certain range around the player (Physics.CheckSphere) and if so you could just instantiate your bullet sound at the position where it entered the players "hear" range :D
      I'm not sure how that's going to sound but I guess it's worth a try. :D

    • @lindal93
      @lindal93 4 ปีที่แล้ว +1

      @@davegamedevelopment Great idea, thanks for the advice, I'll try to implement it!

    • @lindal93
      @lindal93 4 ปีที่แล้ว

      @@davegamedevelopment As far as I understand, the checkSphere deals with object colliders. But what if the object does not have a collider? My bullet has only raycast beams, how then will the sphere check know that the bullet has crossed with it?

  • @hopili1235
    @hopili1235 2 ปีที่แล้ว +1

    Really great video. However, I intend to add multiple weapons and when I try to use the same script there are errors, is there a way to fix it?

  • @straightshot6981
    @straightshot6981 3 ปีที่แล้ว +1

    TYSM

  • @uncleboby5952
    @uncleboby5952 2 ปีที่แล้ว

    Very cool tutorial! I have a question though, To limit the amount of data being created by shooting projectiles can you include a way to despawn them after they are fired?

    • @linkdev3916
      @linkdev3916 2 ปีที่แล้ว

      this was what i was thinking, like after a collision they should despawn

    • @zypherone
      @zypherone 2 ปีที่แล้ว

      This is covered in the second part

  • @Lentspleyageim
    @Lentspleyageim 3 ปีที่แล้ว +1

    Hi, ty... And if I need destroy clones after idk 3 bullets or imediatly after hit, what ican to do?

  • @consultingprestig2096
    @consultingprestig2096 2 ปีที่แล้ว +2

    Have you do error ? You forget " { } " expression.. or its normaly .. you no close if..

    • @davegamedevelopment
      @davegamedevelopment  2 ปีที่แล้ว +1

      You only need to add this expression when the if statement contains more than one line of code :D

    • @consultingprestig2096
      @consultingprestig2096 2 ปีที่แล้ว +1

      Ok thanks 👌 🤓

  • @mr.phantomdx10669
    @mr.phantomdx10669 3 ปีที่แล้ว +1

    can u tell me how i can move my gun with dani player movement script

  • @blackboydre6206
    @blackboydre6206 3 ปีที่แล้ว +1

    Does this work for medieval weapons? Like bows, crossbows, etc.

  • @Devsycoder
    @Devsycoder ปีที่แล้ว

    I could also possibly implement this on my plane system right? If I implement the shooting system like a point of shot this is plausible right?

  • @GanicuusFleXiTDrakensangOnline
    @GanicuusFleXiTDrakensangOnline 3 ปีที่แล้ว

    Awesome video!
    How you put that ammo pointer in there. I've been trying for over 2 hours and I can't figure it out.
    Thanks

    • @ttkk187
      @ttkk187 3 ปีที่แล้ว

      8:32 hesaid it there :) sorry for the delay

  • @XSA1R
    @XSA1R 3 ปีที่แล้ว +1

    Thank u

  • @docrobust
    @docrobust 3 ปีที่แล้ว +1

    I got it working but when I fire, the projectile stays in the air where the gun's barrel is and because it has a rigidbody, I collide with them and stop moving. Is there a way to get them to be thrust forwards and also be destroyed after a few seconds?

  • @Cussaur
    @Cussaur 3 ปีที่แล้ว +1

    Can you make it so I dont have infinite ammo

  • @kareembutler5916
    @kareembutler5916 3 ปีที่แล้ว

    do you have a video how to make all type of guns for a 2d game?

  • @staskholopkin7739
    @staskholopkin7739 2 ปีที่แล้ว

    Grate Tutorial! But i have some errors with directionWithoutSpread. How to fix it?

  • @Mrcorn000
    @Mrcorn000 3 ปีที่แล้ว +1

    The tutorial is awsome bot it always say (trying to invoke method : gun.resetShot couldnt be called

  • @hookercash9971
    @hookercash9971 2 ปีที่แล้ว

    Thanks Pimp

  • @MeowCowYT
    @MeowCowYT หลายเดือนก่อน

    thanks😁

  • @acropolise2945
    @acropolise2945 4 ปีที่แล้ว +1

    amazing...

  • @fishperson5390
    @fishperson5390 2 ปีที่แล้ว +2

    My bullets are only going straight forward not up or down independent of any inclination on the gun
    Idk if it has anything to do with having a system where it only goes first person while aiming
    Edit: I fixed it, the game is alternates between fixed cameras like old RE and first person when aiming
    I fixed it by having copying the first person camera, setting it to not render nothing and always copy the first person camera's rotation, and using that as FPScam

    • @urielcobo-cuisana2316
      @urielcobo-cuisana2316 2 ปีที่แล้ว

      thanks! this helped me too!

    • @urielcobo-cuisana2316
      @urielcobo-cuisana2316 2 ปีที่แล้ว

      hi! sorry, but how could you make the camera not render anything?

    • @fishperson5390
      @fishperson5390 2 ปีที่แล้ว

      @@urielcobo-cuisana2316 Go on the inspector, in camera find cooling mask and change it from everything to nothing
      You can use this to select what layers the camera renders so you can make some stuff invisible and etc

  • @panickal
    @panickal 2 ปีที่แล้ว

    Is it okay that I don't fully understand this code but use it?

  • @aligamiles
    @aligamiles 4 ปีที่แล้ว +2

    Cool

  • @nightmarevstplugin3944
    @nightmarevstplugin3944 2 ปีที่แล้ว

    Thanks

  • @Isimpforanimemen
    @Isimpforanimemen ปีที่แล้ว

    not sure what im doing wrong, since i followed everything correctly but the bullets don't shoot. Am I missing something else?

  • @MrMikhaelJackson
    @MrMikhaelJackson 2 ปีที่แล้ว +1

    Hi, when I did everything it all worked! But when I move my camera around the gun doesn't move do you know how to fix it

    • @davegamedevelopment
      @davegamedevelopment  2 ปีที่แล้ว

      Make sure that the gun is a child object of your camera :D (Drag & Drop the gun into your camera object)

    • @MrMikhaelJackson
      @MrMikhaelJackson 2 ปีที่แล้ว +1

      @@davegamedevelopment I did it but when I go to play it just falls through the ground if I go into scene view I see that the gun container is moving and my gun is a child of it

    • @davegamedevelopment
      @davegamedevelopment  2 ปีที่แล้ว

      @@MrMikhaelJackson make sure the rigidbody is set to kinematic

  • @legoalternator2.014
    @legoalternator2.014 2 ปีที่แล้ว +1

    sodint you cal it a remaster of your previous video?

    • @davegamedevelopment
      @davegamedevelopment  2 ปีที่แล้ว

      Yeah it's kind of a better version of my any kinds of guns tutorial, this time with custom projectiles :D

  • @scottgamedev8542
    @scottgamedev8542 3 ปีที่แล้ว +1

    It works great but i have a a few things i would like to tweak if you could help me please
    How to destroy the bullet after 2 seconds (I do know how to do this but its better if it comes from you as its your script and i dont place it in the wrong place

    • @martinschifer3603
      @martinschifer3603 3 ปีที่แล้ว

      Hey I have trouble shooting more than one bullet, it doesn't work, do you know why this could be?

  • @thewarfare202
    @thewarfare202 ปีที่แล้ว

    I don't know how to make the basic bullets do damage to my enemy, any help.

  • @gaminganimator-qp2ir
    @gaminganimator-qp2ir 4 ปีที่แล้ว +1

    thanks alot(:

  • @Mnap
    @Mnap 4 ปีที่แล้ว

    My bullet is spreading like crazy when i point at object.. how do i fix this?

  • @不要過來啊啊啊
    @不要過來啊啊啊 2 ปีที่แล้ว

    Is there a way to prevent bullets from glitching when the player is moving forward?

  • @Incognian
    @Incognian 2 ปีที่แล้ว +2

    You sound like Brackeys ngl

  • @begezet9380
    @begezet9380 2 ปีที่แล้ว +1

    is this Brackey's brother >?