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)
@davegamedevelopment4 жыл бұрын
Haha, thanks a lot man! Glad I could help! :D
@aaronscreations9472 жыл бұрын
@@ebsku now 2 but still deserves it
@randoavis2 Жыл бұрын
he should really have more subcribers
@sonoakneely95746 ай бұрын
sry but its 2024 with 4k likes sry to break it too you
@GodBeast_FireOnHell Жыл бұрын
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
@davegamedevelopment Жыл бұрын
Thanks a lot! Glad I could help :D
@GlasTaibhse11 ай бұрын
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!
@Blaxe7511 ай бұрын
fr tho also I cant believe you juste posted a comment
@crazycraftcreations66254 жыл бұрын
You are the Future Barckeys He left :(
@jlgaming99974 жыл бұрын
@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
@jlgaming99974 жыл бұрын
@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_herobrine37524 жыл бұрын
@James Thwaites guess these tutorials are for people who have a basic understanding of unity c# and want to learn more
@austinwhiteted82314 жыл бұрын
@@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.
@adhochero66193 жыл бұрын
@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.
@stevenjuana39204 жыл бұрын
Great video! Can't wait for the rest of the series!
@davegamedevelopment4 жыл бұрын
Thanks! The second part should be published this week :D (Hopefully... ^^)
@sonoakneely95746 ай бұрын
theres only 2 parts
@non-shockingtopics75632 жыл бұрын
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!
@mutatedsun60472 жыл бұрын
Thanks my dude
@stephenmurya2 жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
It made me bullets not shoot through the center of the screen though
@MrHerrJonsson4 жыл бұрын
Great tutorial mate and you solved my greatest issue, which is to make the projectile travel towards the center of the screen. Much appreciated!
@davegamedevelopment4 жыл бұрын
Yeah indeed, that's a bit tricky :D Glad I could help you! :D
@ArranAsh4 жыл бұрын
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!
@thecrispyacorn3 жыл бұрын
it was super fast, i was just loading up my project when he started typing.
@Detective_depther8 ай бұрын
@@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
@thecrispyacorn8 ай бұрын
@@Detective_deptherbro 😭
@burgerfanman3 жыл бұрын
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_I2 жыл бұрын
lol i was just watching one of Brackeys first person tutorials, now i wanted to make weapons.
@erentst2 жыл бұрын
im just so greatful Dave exists.
@a3dadventure79 Жыл бұрын
thanks for your work. you're vids are a great resource for those learning Unity!
@Intro2Love3 жыл бұрын
Sticky bullets sounds awesome 😎👍
@stevethepirate10 ай бұрын
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.
@HOMOLUDENSJM3 жыл бұрын
The next Brackeys. LONG LIVE THE KING
@bumba57274 жыл бұрын
Great video! i really liked how you showed us how to set the gun up! thanks!
@SacWebDeveloper Жыл бұрын
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.
@nikhilchhetri9004 жыл бұрын
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.
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.
@ScoutsStudios4 жыл бұрын
You are gods gift to noobs and professionals.
@cem80152 жыл бұрын
thank you so much! this tutorial has helped me a lot
@firecreeper909 ай бұрын
"You don't want any upward force on your bullets" Me who will create a gun with bullets similar to a boomerang :b
@smbiplob94762 жыл бұрын
Amazing tutorial! You are awesome !!!! Thankyou
@davegamedevelopment2 жыл бұрын
Glad you like it!
@Intro2Love3 жыл бұрын
Sticky bullets would be cool😎 Like the plasma grenades in HALO😁👍
@BecksCraft3 жыл бұрын
Keep Going man. Love it!
@satobi462 жыл бұрын
Thank you so much Bra-, I mean Dave.
@plumburger70102 жыл бұрын
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 Жыл бұрын
I know its late but you probably have another scrips called "Camera"
@suxpop21714 жыл бұрын
Great video, brother! :)
@pumpkii3 жыл бұрын
OH MY GOSH AM I THE ONLY ONE WHO REALIZES THAT HE'S JUST COPY AND PASTING BRACKEYS VIDEOS
@miguelanterodevsgaming65293 жыл бұрын
@@pumpkii not all but ye he's kinda doin that
@ebrahimmomin75182 жыл бұрын
You earned a subscriber
@davegamedevelopment2 жыл бұрын
Thanks :D
@JustMatt221-w6x11 ай бұрын
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-w6x11 ай бұрын
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_clips8 ай бұрын
@@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
@aimlezz88552 жыл бұрын
Good stuff. Thanks!
@ebrahimmomin75182 жыл бұрын
If your making a FPS game, he also has a video on first person player movement which helped me alot
@davegamedevelopment2 жыл бұрын
And lots of other movement tutorials :D
@clarkmeyer72113 жыл бұрын
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.
@perrylets4 жыл бұрын
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.
@davegamedevelopment4 жыл бұрын
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
@perrylets4 жыл бұрын
@@davegamedevelopment THX
@g5haco4 жыл бұрын
your tutorials make me go Y E S
@davegamedevelopment4 жыл бұрын
Thanks man :D
@g5haco4 жыл бұрын
@@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
@TheBagOfGames Жыл бұрын
thanks :)
@oblo49524 жыл бұрын
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
@davegamedevelopment4 жыл бұрын
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)
@oblo49524 жыл бұрын
@@davegamedevelopment k thanks
@juliuslukosevicius93604 жыл бұрын
Did you add force to it? (if you didnt then go watch 5 : 13 there he adds force to the bullet)
@AldinCraft4 жыл бұрын
Great tutorial :)
@davegamedevelopment4 жыл бұрын
Thanks a lot! :D
@WilliamDoesStuff2 жыл бұрын
Thanks, I will use this in a VR game
@cardboardtoaster21692 жыл бұрын
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
@SharkyVR2 жыл бұрын
Is there any way to make the bullets do damage to an AI?
@mykytamolodtsov87344 жыл бұрын
Great tutorial, ty, man, I'm lucky I found it ;)
@davegamedevelopment4 жыл бұрын
Thanks a lot! Glad I could help you :D
@Ocer.4 жыл бұрын
Hey, Im here from the Enemy AI tutorial, how do I combind this script with the enemy AI one?
@zypherone2 жыл бұрын
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 Жыл бұрын
@@zypherone how do I delete the projectiles after they have been shot
@prameelarani80054 жыл бұрын
You are brackeys thanks mate
@majitelpravdy91062 жыл бұрын
Great tutorial!!!!!! keep going
@davegamedevelopment2 жыл бұрын
Thanks a lot! I will definitely continue :D
@john_p51623 жыл бұрын
8:35 why you have a prefab called ender pearl!?
@lindal934 жыл бұрын
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
@davegamedevelopment4 жыл бұрын
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
@lindal934 жыл бұрын
@@davegamedevelopment Great idea, thanks for the advice, I'll try to implement it!
@lindal934 жыл бұрын
@@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?
@LionDev4 жыл бұрын
Yo this was absolutely interesting because I'll maybe make a fps after my RPG where this will be incredible helpful thanks man
@davegamedevelopment4 жыл бұрын
Glad you liked it! :D
@consultingprestig20962 жыл бұрын
Have you do error ? You forget " { } " expression.. or its normaly .. you no close if..
@davegamedevelopment2 жыл бұрын
You only need to add this expression when the if statement contains more than one line of code :D
@consultingprestig20962 жыл бұрын
Ok thanks 👌 🤓
@xdxdxd65993 жыл бұрын
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?
@MrMikhaelJackson2 жыл бұрын
The same things happing to me
@themanipulation45812 жыл бұрын
you need to change where the shootpoint is
@mhze2 жыл бұрын
script link is not working plz fix it
@durgam_sumerian78154 жыл бұрын
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.
@legoalternator2.0142 жыл бұрын
sodint you cal it a remaster of your previous video?
@davegamedevelopment2 жыл бұрын
Yeah it's kind of a better version of my any kinds of guns tutorial, this time with custom projectiles :D
@hopili12352 жыл бұрын
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?
@kristijandrgestin8634 жыл бұрын
izvrsno nice work bro
@davegamedevelopment4 жыл бұрын
Thanks man! :D
@kareembutler59163 жыл бұрын
do you have a video how to make all type of guns for a 2d game?
@thanhatchau585211 ай бұрын
Thank you very much
@Dreskii044 жыл бұрын
Does this work for medieval weapons? Like bows, crossbows, etc.
@zypherone2 жыл бұрын
It can
@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?
@rabi0ne4 жыл бұрын
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.
@davegamedevelopment4 жыл бұрын
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
@thedev61724 жыл бұрын
Love your videos...plz make a tutorial on enemy ai with anims
@davegamedevelopment4 жыл бұрын
I'll definitely make a tutorial on fps enemy ai! Just give me a few weeks, currently also working on other videos :D
@Lentspleyageim3 жыл бұрын
Hi, ty... And if I need destroy clones after idk 3 bullets or imediatly after hit, what ican to do?
@staskholopkin77392 жыл бұрын
Grate Tutorial! But i have some errors with directionWithoutSpread. How to fix it?
@docrobust3 жыл бұрын
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?
@mr.phantomdx106693 жыл бұрын
can u tell me how i can move my gun with dani player movement script
@benjamingraham91224 жыл бұрын
when i get close to something the bullets spread out more so its really hard to hit things
@davegamedevelopment4 жыл бұрын
Yeah I know, that's a bit of a problem. You can eighter just turn down the spread value or try making a script that lowers the spread the closer you are to the target :D
@josimar84974 жыл бұрын
@@davegamedevelopment please can you make a tutorial about this, I'm kinda new on unity
@davegamedevelopment4 жыл бұрын
@@josimar8497 Thanks for the idea, but I'm not sure if I'll do one (already planned others). But for now just lower the spread value in the Unity inspector :D
@josimar84974 жыл бұрын
@@davegamedevelopment ok thanks, your channel is very good by the way
@davegamedevelopment4 жыл бұрын
@@josimar8497 Thanks! :D
@panickal3 жыл бұрын
Is it okay that I don't fully understand this code but use it?
@artdays95612 жыл бұрын
AMAZING!!! But for some reason the bullets dont go to where my crosshair is?
@MeowCowYT3 ай бұрын
thanks😁
@umutbozkurt68603 жыл бұрын
You are amazing!!
@XSA1R3 жыл бұрын
Thank u
@krisman-s4h4 жыл бұрын
I have one question. Why do my bullets instantiate one by one instead of at once and so my bullet text lowers the numbers one by one?
@davegamedevelopment4 жыл бұрын
If you set the "timeBetweenShots" to 0 and "bulletsPerTap" to something like 5, all of the bullets should spawn (nearly) at the same time :D
@krisman-s4h4 жыл бұрын
@@davegamedevelopment Thank you very much!
@GanicuusFleXiTDrakensangOnline4 жыл бұрын
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
@ttkk1873 жыл бұрын
8:32 hesaid it there :) sorry for the delay
@justinklasnic29234 жыл бұрын
Perfect!
@davegamedevelopment4 жыл бұрын
Thanks!
@ronak38132 жыл бұрын
does it have recoil?
@davegamedevelopment2 жыл бұрын
In the second part I showed how to add recoil :D
@MrMikhaelJackson2 жыл бұрын
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
@davegamedevelopment2 жыл бұрын
Make sure that the gun is a child object of your camera :D (Drag & Drop the gun into your camera object)
@MrMikhaelJackson2 жыл бұрын
@@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
@davegamedevelopment2 жыл бұрын
@@MrMikhaelJackson make sure the rigidbody is set to kinematic
@l.halawani9 ай бұрын
Shouldn't we normalize the direction before applying spread?
@straightshot69813 жыл бұрын
TYSM
@IceezV23 жыл бұрын
Does the character movement and gun setup come with this script? Or do I need to find it on my own?
@matusgls3 жыл бұрын
can samobedy help me with how to add sound when you shot ?
@BOUCHIIGAMING4 жыл бұрын
I find it ty 😂❤️❤️❤️
@juliuslukosevicius93604 жыл бұрын
this mad man made a video on how to make an entire shooting system in 9 Minutes it fast tho
@acropolise29454 жыл бұрын
amazing...
@davegamedevelopment4 жыл бұрын
Acropolise Thanks a lot! :D
@nightmarevstplugin39442 жыл бұрын
Thanks
@uleesesrenzbalbastro30383 жыл бұрын
Hey, I'm having a problem with the position of the bullet and muzzle flash when I fire. The bullet and the muzzle flash doesn't rotate with the gun.
@whitesheep14172 жыл бұрын
Is the attackpoint a child of your gun?
@thewarfare202 Жыл бұрын
I don't know how to make the basic bullets do damage to my enemy, any help.
@begezet93802 жыл бұрын
is this Brackey's brother >?
@davegamedevelopment2 жыл бұрын
Maybe, who knows
@Cussaur3 жыл бұрын
Can you make it so I dont have infinite ammo
@amelzolotic13644 жыл бұрын
Im getting this error: The name directionWithoutSpread does not exist in the current context. Everything is on its place and typed correctly
@kulak85484 жыл бұрын
Try downloading the script from the video and see if that works. If it does, you may have made some very small mistake.
@bennydaboy69844 жыл бұрын
Really useful, But could you make the bullets disappear and use when they collide with something, This would be very helpful thanks.
@davegamedevelopment4 жыл бұрын
Sure, just have a look at the second part of the series, there I explained how to make the explosion etc. :D
@bennydaboy69844 жыл бұрын
@@davegamedevelopment Thanks this will help a lot + U got a new subscriber :0
@Tacky_I2 жыл бұрын
@@bennydaboy6984 Wow, 2 favorited comments in one, amazing!
@uncleboby59522 жыл бұрын
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?
@linkdev39162 жыл бұрын
this was what i was thinking, like after a collision they should despawn
@zypherone2 жыл бұрын
This is covered in the second part
@gaminganimator-qp2ir4 жыл бұрын
thanks alot(:
@mr.phantomdx106693 жыл бұрын
Sir how can i add dani gun reload animation on ur script plz tell me i need ur help
@darshilpatel43223 жыл бұрын
How to type like u man, amazing skills, give some tips for typing . btw amazing video
@Isimpforanimemen Жыл бұрын
not sure what im doing wrong, since i followed everything correctly but the bullets don't shoot. Am I missing something else?
@travel21203 ай бұрын
good shit man :)
@lifelessplaysgames96664 жыл бұрын
Hey so i have the problem that when i aim at something my bullet spread increases for some reason
@mook_103 жыл бұрын
that's because it doesn't check how far away its target is before applying spread. the spread on the ground will look exactly the same as in the air for instance because it's just applying the same spread when realistically it should scale with the target's distance. unfortunately i have no idea how to solve this so if anyone else in the replies knows a fix please let me know
@Funoriginality4 жыл бұрын
I wrote up the script, put in the semicolons I forgot to write, and then got an error labeled "[10:20:50] ASsets\Gunz.cs(83, 27: error CS0165: Use of unassigned local variable 'hit'" I have the "RaycastHit hit;" line in there so I know it's defined, and I don't quite understand what's wrong, any help would be greatly appreciated
@Funoriginality4 жыл бұрын
Got it sorted, messed up the "out ray" bit
@davegamedevelopment4 жыл бұрын
@@Funoriginality Np, glad you could fix it :D
@lari687210 ай бұрын
Hey, I have been having an issue with the muzzle flash it seems to always be facing one direction and doesn´t follow the rotation of the gun at all, I have been trying to fix this for hours.
@firecreeper909 ай бұрын
Do you still need help?
@不要過來啊啊啊2 жыл бұрын
Is there a way to prevent bullets from glitching when the player is moving forward?