Тёмный

FULL PICK UP & DROP SYSTEM for WEAPONS or ITEMS || Unity3d Tutorial 

Dave / GameDevelopment
Подписаться 38 тыс.
Просмотров 185 тыс.
50% 1

FULL PICK UP & DROP SYSTEM || Unity3d Tutorial:
Since I just started my series on how to shoot with projectiles in Unity, I thought it would be cool to share how to make a full pick up and drop system :D
Don't forget to subscribe if you enjoyed the video, and if you have any questions just write a comment, I'll answer as many as I can! :D
Links:
➤ DOWNLOAD the SCRIPT: www.mediafire.c...
➤ DOWNLOAD the PROJECT (in the free-code-dave channel): / discord
➤ DON'T CLICK: bit.ly/2VcrDZt
If you want here's the series about the GUN SYSTEM USED in the video:
➤ • SHOOTING with BULLETS ...
🏹 Get Access to my RANGED COMBAT LAB! 🏹
➤ Trailer: • RANGED COMBAT LAB - Un...
➡️ Get Access to my full MOVEMENT LAB! ➡️
➤ Trailer: • MOVEMENT LAB - Unity P...
Other interesting videos :D
➤ Full WALL RUN tutorial: • Full WALL RUN TUTORIAL...
➤ My FIRST YEAR of game development: • My FIRST YEAR of UNITY...
Support me on Patreon:
➤ / davegamedevelopment
Music used:
➤ Elevate - LiQWYD: • Elevate - LiQWYD (No C...
➤ Night Out - LiQWYD: • Night Out - LiQWYD (No...
#UnityTutorial #PickUpWeapon #Unity3d

Опубликовано:

 

15 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 755   
@davegamedevelopment
@davegamedevelopment Год назад
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 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: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-j2YplilHjCA.html Thanks so much for watching, hope this tutorial has helped you!
@taylormarinescu805
@taylormarinescu805 4 года назад
This guy is such a good youtuber. He creates full, easy to understand tutorials and responds to almost every comments even if it's off topic. 100% liked and subbed :)
@davegamedevelopment
@davegamedevelopment 4 года назад
Thank you so much! :D
@itsAdopo_DevXD
@itsAdopo_DevXD Год назад
@@davegamedevelopment i dont know why the Pickup stuff didnt work the gun is droped but The pick up does not work but thx u helped us so much 😁😁
@creapermann6356
@creapermann6356 4 года назад
I almost cried as it worked, i spent over 10h on it
@davegamedevelopment
@davegamedevelopment 4 года назад
I feel you man... Sometimes coding stuff takes wayy too long :D
@bosstankproductions1304
@bosstankproductions1304 3 года назад
Dave / GameDevelopment I have a question. Will it work if I just use Right click in the part where it says E or or what does the code need to say if I want right click pick up ?
@TUMENG-TSUNGF
@TUMENG-TSUNGF 3 года назад
Input.GetMouseButtonDown(1)
@developer2
@developer2 3 года назад
@Domantuso_gaming mate can you just say fuck and shit without censoring it
@bruh-gy6yx
@bruh-gy6yx 3 года назад
@@developer2 lmao
@crazykidplayz6498
@crazykidplayz6498 2 года назад
This man deserves more support his tutorials are amazing! I’m writing this comment to show all the support I can!
@itztecherz
@itztecherz 2 года назад
This Guy Is A Such A Good Person, He Gives The Codes And Understands We Easily
@davegamedevelopment
@davegamedevelopment 2 года назад
Thanks a lot!
@tabithagiblet1644
@tabithagiblet1644 3 года назад
top 10% of Unity tutorials right here, and I've sure as hell watched pretty much all of them
@disgraceme
@disgraceme 3 года назад
Here's the script: using System.Collections; using System.Collections.Generic; using UnityEngine; public class PickupGun : MonoBehaviour { public Gun gunScript; public Rigidbody rb; public BoxCollider coll; public Transform player, gunContainer, fpsCam; public float pickUpRange; public float dropForwardForce, dropUpwardForce; public bool equipped; public static bool slotFull; private void Start() { if (!equipped) { gunScript.enabled = false; rb.isKinematic = false; coll.isTrigger = false; } if (equipped) { gunScript.enabled = true; rb.isKinematic = true; coll.isTrigger = true; slotFull = true; } } private void Update() { Vector3 distaceToPlayer = player.position - transform.position; if (!equipped && distaceToPlayer.magnitude
@jackcurry7506
@jackcurry7506 2 года назад
thx
@katon60fps
@katon60fps 2 года назад
you are a life saver
@piska28
@piska28 2 года назад
thx
@user-ku8pr9ti9n
@user-ku8pr9ti9n 2 года назад
thank you from Russia😁
@Tri_Music
@Tri_Music 2 года назад
Thanks :D
@ilypavan
@ilypavan Год назад
Set Interpolate to :None if your object is not moving as your view camera.
@2kmagic774
@2kmagic774 10 месяцев назад
Thanks a lot
@MintVRr1
@MintVRr1 3 дня назад
thank u so much i was about to restart
@lucasburford7881
@lucasburford7881 2 года назад
Absolutely amazing, thank you so much, my player can now pick up a flashlight in my horror game! 😁
@creapermann6356
@creapermann6356 4 года назад
Thanks, i tried the last month to do a good pick up and drop script cause there is no one on youtube. You just got one new active member :) TY
@davegamedevelopment
@davegamedevelopment 4 года назад
Glad it helped you! Thanks for watching :D
@creapermann6356
@creapermann6356 4 года назад
@@davegamedevelopment thanks for doing it
@Broskibrow
@Broskibrow 2 года назад
my game just became 1 step closer 2 done. Thank you so much for this tutorial!
@davegamedevelopment
@davegamedevelopment 2 года назад
That's nice to hear, glad I could help!
@theokruger4900
@theokruger4900 3 года назад
You my good sir is a legend among this community, insane tutorial💪🏻
@decidev
@decidev 3 года назад
Coming back to these tutorials after learning c# and they are so much easier to understand!
@davetrapyt2958
@davetrapyt2958 2 года назад
same.
@TheRealWhatKid
@TheRealWhatKid Год назад
Hi, I know this video was posted 2 years ago, but hope you can help. I followed the tutorial and got done, but, when I click E it will go to what I set it to go (Item Container) to but then it just floats around and doesn't exactly stay with the Item Container when I look around. How do I fix this?
@Iam_tails
@Iam_tails Год назад
im so glad i can find a tutorial youtuber like you bc most of the other youtubers are just like do this do that then you will have this. but u explain what everything means wich is very helpful for beginners like me.
@Justeeee115
@Justeeee115 3 месяца назад
Hi I've been working on top down 2d game and cant really find a good tutorial for pickup and drop weapons so I have no choice but to use this tutorial and after editing the whole script to work with 2d I've manage to make it work so awesome thanks for this tutorial helpful enough!
@unknownunknown-pg1fg
@unknownunknown-pg1fg 11 дней назад
Thanks for the help. Took 15 minutes and works great
@Seestral
@Seestral 2 года назад
super well done man! Even though it's almost a 2 year old video it helped me a lot.
@davegamedevelopment
@davegamedevelopment 2 года назад
Glad you like it!
@D4RKTornado
@D4RKTornado 2 года назад
I set the rigidbdy to extrapolate and continous dynamic but it still bugs?
@BadBanana
@BadBanana 4 года назад
Very nice Used it in my.personal project. Working well Enjoying playing with the script.
@davegamedevelopment
@davegamedevelopment 4 года назад
Thanks a lot, glad you like it! :D
@Kosten47
@Kosten47 Год назад
To everyone who has the problem with this line:" public ProjectileGun gunScript;" u have to use instead of ProjectileGun the name of the gun script u have to shoot and stuff. So Get the name from the gun script and put it instead of "ProjectielGun". for example it should look like this :public Gun gunScript;
@Eternal_Night17
@Eternal_Night17 9 месяцев назад
Thanks bro that really helps me out
@skyblade_studios
@skyblade_studios 4 года назад
Thank you, I hope you helped many people, for some reason, this broke my entire game having to completely restart. Nothing against you, probably something i did wrong, but i hope you can help other people
@davegamedevelopment
@davegamedevelopment 4 года назад
Oh sorry, I don't think it was your fault, sounds more like Unity's problem, normally a simple script shouldn't break your whole game... :( But glad your not angry, if you want you can still download the project file and check out how everything is set up there :D
@skyblade_studios
@skyblade_studios 4 года назад
@@davegamedevelopment All good, just got a different tutorial for pick up and drop thanks for replying
@sebastianvoinea1189
@sebastianvoinea1189 3 года назад
I need some help. When i pick up the gun the gun does not follow the player. It just stay in the air. But if i press left click the gun is shoting.
@Blaxe75
@Blaxe75 7 месяцев назад
same
@vishnuramesh2514
@vishnuramesh2514 3 года назад
Mannn this is such an amazing tutorial! everything worked perfectly at one go! I wish you all the best with your channel!
@itzdimi7569
@itzdimi7569 Год назад
are you using his movement system and if so where does the guncontainer go to?
@vishnuramesh2514
@vishnuramesh2514 Год назад
@@itzdimi7569 I'm not using his movement system...but my gun container is the child of my camera
@cybertech107lite6
@cybertech107lite6 2 года назад
Thankyou so much Dave, works very well making my game so much better!
@davegamedevelopment
@davegamedevelopment 2 года назад
Glad I could help!
@cybertech107lite6
@cybertech107lite6 2 года назад
@@davegamedevelopment Sorry to ask, but would you know how to make dani's grid material, not the prototype grids one but the new one that he usesin his videos
@babasheep2828
@babasheep2828 2 года назад
Great tutorial, just one thing. After adding this, the shooting just broke. The bullets now fly backward and not out of my barrel. Any idea why this is happening?
@AldinCraft
@AldinCraft 4 года назад
Thanks you so much i keep finding this tutorial
@davegamedevelopment
@davegamedevelopment 4 года назад
No problem :D Congrats for first comment btw :D
@imzary
@imzary 4 года назад
@@davegamedevelopment you are an amazing guy (;
@davegamedevelopment
@davegamedevelopment 4 года назад
@@imzary Thanks :D
@imzary
@imzary 4 года назад
@@davegamedevelopment np :D
@wolfballer2178
@wolfballer2178 2 года назад
what happens with me is my gun dont stay in my hand it starts going forward when i go backward and when i go backward it gos forward and ive tried turning off all rotations on the rigid body but it didnt work all I know is that everytime i enable the rigid body it stays in one place plsss help
@wolfballer2178
@wolfballer2178 2 года назад
the only thing that works is the throw machinic which gets thrown from a far distance
@gioviale7702
@gioviale7702 Год назад
This tutorial helped me a lot, thank u so much now i've eradicated what i was having trouble with. i love u mate, i mean i love u as a friend really... oh no... it is coming back
@tylerpurner7816
@tylerpurner7816 4 года назад
First tutorial with pick up and drop combined. Thxx for that. Without this i would die
@davegamedevelopment
@davegamedevelopment 4 года назад
Haha, glad they could help you! :D
@vfx_mikaliero
@vfx_mikaliero 2 года назад
The type or namespace name 'ProjectileGun' could not be found (are you missing a using directive or an assembly reference?) Help me fix it!
@davegamedevelopment
@davegamedevelopment 2 года назад
How is your gun script called? It either needs to be exactly "ProjectileGun" or you need to Change the variable type to whatever the name of your gun script is :D
@vfx_mikaliero
@vfx_mikaliero 2 года назад
Thank you, I'll try that
@keilithdevine
@keilithdevine 3 года назад
this guy is as good as Brackeys (R.I.P Brackeys YT Channel)
@duelsoldier3048
@duelsoldier3048 3 года назад
Gotta say man seriously good content unlike any other youtuber! keep it up!
@Viviko_real
@Viviko_real 2 года назад
I'm having an issue with the shooting. I want to start the game without holding the gun which works fine. The gun isn't equipped and I can't shoot it. I pick it up and I'm able to shoot it and it's marked as equipped. However, after dropping it again, I'm still able to shoot it. Is there a way I can fix this? Thanks
@MalcolmEkajja
@MalcolmEkajja Год назад
Did you find a solution?
@NoodleFoxYT
@NoodleFoxYT Год назад
Dave you truly are amazing so far you are the only unity tutorial creator that shares his code for free and also the only one who has code that works first try love your tutorials they help me real good and it's easy to understand thank you so much keep it up
@AbusingEgo
@AbusingEgo 2 года назад
My god, thank you soooooo much for adding the script download!!!!! :)))
@davegamedevelopment
@davegamedevelopment 2 года назад
No problem :D
@cthulhuplays6097
@cthulhuplays6097 3 года назад
So a slight problem. I imported a model and now it just shrinks it after I pick it up, I tried with a model I made and one I downloaded.
@clearnandimprove4604
@clearnandimprove4604 3 года назад
make sure all parents are scaled at 1 1 1. The character camera weapon and container. if you need to change the size do it from the item in the project window/ go to the model option and change scale factor to what you need.
@Asensado
@Asensado 4 года назад
Hey Dave, so I realized that when you pick up the gun, it just teleports to you. But when you throw it, it smoothly reacts to gravity and makes it feel that you're actually throwing the gun. I want to also feel that I am picking up the gun, not teleporting it to my hand. Anyways, nice video. Keep it Up!
@davegamedevelopment
@davegamedevelopment 4 года назад
For this you need to learn a bit about the Vector3.Lerp and Quaternion.Slerp functions, then it should move smoothly from one point to the other :D But for some reason it didn't really work when I tried out
@lewis5796
@lewis5796 3 года назад
@@davegamedevelopment slerp
@zeaglee3432
@zeaglee3432 Год назад
Hi! I know it is bit late but anyway. I think you already solved it but for any chance if anyone is looking for this it is a bit simple but tricky. For this instead of setting local position in pick up you will do it in FixedUpdate(). (Note: I would love to share the script however I made many changes to the original version for my preferences) 1) Just add two new parameters : float pickUpTime; bool pickingUp; 2) Then you will chance script a bit. You will remove the part where you set your gun position. Instead you will add two lines : pickingUp = true; Invoke(nameof(PickUpFinished), pickUpTime); 3) Make a new method : void PickUpFinished() { pickingUp = false; } 4) Last step paste in these lines into FixedUpdate() and that is all : if (pickingUp && currentWeapon != null) { Vector3 zero = Vector3.zero; currentWeapon.transform.localRotation = Quaternion.Slerp(currentWeapon.transform.localRotation, Quaternion.Euler(Vector3.zero), Time.deltaTime * pickUpTime * 10f); currentWeapon.transform.localPosition = Vector3.SmoothDamp(currentWeapon.transform.localPosition, Vector3.zero, ref zero, 1f / (pickUpTime * 10f)); } Note : These variables there are not that perfect. I haven't completed it yet put it does the job for now. I hope that is what you need. Good luck with your game!
@idikutkasgarli3637
@idikutkasgarli3637 Год назад
​@@zeaglee3432 Thank you it helped me a lot, it's all working fine but when I change the pickUpTime on the inspector nothing changes so I'm wondering why? is it supposed to be act like that or not?
@pocketbeans4714
@pocketbeans4714 Год назад
@@zeaglee3432 says currentWeapon doesnt exist
@SamuelArmer
@SamuelArmer 3 года назад
go to throw the the 'gun' in my case just a cube, and it works, try again a second time and it plumets straight down, no momentum. Any help appreciated
@hannesnolle2003
@hannesnolle2003 3 года назад
When i start the game the guns at the ground just slied away and if i pick them up i cant shoot. Can someone pls help me?
@Gaylocaust
@Gaylocaust 4 года назад
cool bro it helped me a lot with making a game in unity
@davegamedevelopment
@davegamedevelopment 4 года назад
Thanks a lot! Glad you like it :D
@useless.production
@useless.production Год назад
You are the best! I hope you keep making these tutorials!!!!
@joey._rsd7261
@joey._rsd7261 4 года назад
Everything is working good but whenever i drop the gun it goes back to 0 0 0 because i have my gun container in my fps cam, anyway i can fix this?
@danielmay1846
@danielmay1846 3 года назад
Did you solve this please??
@dumbguy1073
@dumbguy1073 4 года назад
there u go mate ur new sub and a follower...i like ur content keep posting more..all the best
@davegamedevelopment
@davegamedevelopment 4 года назад
Thank you so much! :D
@quae6843
@quae6843 2 года назад
It's perfect! Currently working on a simple FPS like Hotline Miami, but with Max Payne's slow motion (or SUPERHOT with generic slow-mo?). Ability to grab and throw guns was just what I needed.
@davegamedevelopment
@davegamedevelopment 2 года назад
Thanks! Glad I could help!
@Xylidine
@Xylidine 2 года назад
For those whose guns are falling through the floor when you drop it, try changing the size of the box collider and make it so it wont clip the floor when you throw it
@nixv2824
@nixv2824 3 года назад
when i try to have multiple guns, if I don't parent to the camera, I cant pick it up. but if I do, it follows the camera even when on the ground
@dinamutan7637
@dinamutan7637 3 года назад
Try making a storage system, where every Gun object you have is parented to GunContainer, but each has a key. When you press that key, it disables the current Gun Object and activates the Gun Object paired to that key.
@djweedsmoke
@djweedsmoke Год назад
My gun keeps falling through the floor when i press q and throw, and i cant see it when i uncheck equipped. help?
@armandopaez8882
@armandopaez8882 Год назад
Add it a box collider
@CodeConnor
@CodeConnor 2 года назад
How do I make it so I can have a secondary primary and a third option? I’m not using this script for guns it’s for items
@cpt.ghostriley735
@cpt.ghostriley735 9 месяцев назад
This video is much better than the others cuz now he's showing hierarchy
@CROXoDyLE
@CROXoDyLE 3 года назад
For anyone who is experiencing their weapons floating up on pickup try making a separate game object called "gun stash" or something and put all of your weapons inside there. it fixed the issue for me.
@howiplay8629
@howiplay8629 3 года назад
Thnx buddy. It helped me a lot
@knedlikcz6517
@knedlikcz6517 Год назад
Bruh, Lifesaver
@ItssVenom
@ItssVenom 2 года назад
I'm kind of confused on how I'm able to keep the item that is picked up in my view. When I look up or down, the item stays in the static spot without following my camera's movement. Is there any way in particular to solve this issue?
@davegamedevelopment
@davegamedevelopment 2 года назад
Make sure that your weapon holder is a child of the camera :D
@eliaskabrt1763
@eliaskabrt1763 6 месяцев назад
@@davegamedevelopmentI have same issue. Like, it moves, but really slow and it looks bad. I have it set as an child of my main camera. So idk what to do.
@iluz1eiluzie370
@iluz1eiluzie370 3 года назад
if I drop mine it goes under the map itself any ideas?
@danielmay1846
@danielmay1846 3 года назад
Did you solve this please?
@r0develop493
@r0develop493 3 года назад
Well that's odd. I followed your tutorial and encountered a weird bug. When using extrapolate, my item would stay in place wherever i go but would still rotate. however when i switched it to none. it fixed it. Not sure if this has something to do with the new unity version but yeah. If anyone else encounters the same bug, that's how i fixed it. Not sure if it's a permanent fix, but it gets the job done.
@mhausage3454
@mhausage3454 3 года назад
I've been trying to fix it for so long now but to no avail. Setting the interpolation it to none do actually fix it but the physics of the gun wouldn't be smooth when reacting to gravity or other rigidbodies. If anyone has a fix to it please tell me
@zypherone
@zypherone 2 года назад
@@mhausage3454 hey bro did you ever find anything out? i just had to change interpolation to none and im hoping you found a fix for the rough physics?
@sp0ngebob561
@sp0ngebob561 4 года назад
Hi great video btw but I have a problem You typed projectile gun which means I could also type the name of my weapon if I'm correct but it couldn't be found and asked if I'm missing a directive or assembly reference I need help please reply 🥺
@davegamedevelopment
@davegamedevelopment 4 года назад
You need to take the exact name of your gun script (The one that makes your gun shoot :D)
@sp0ngebob561
@sp0ngebob561 4 года назад
@@davegamedevelopment yup I found out yesterday lol thanks for the reply
@ezrafarwell393
@ezrafarwell393 4 года назад
@@davegamedevelopment im confused, i try to rename it but it says that there is already a script with the same name
@davegamedevelopment
@davegamedevelopment 4 года назад
@@ezrafarwell393 You probably used a name that's already used by Unity (like System, Input etc.) :D Try changing it :D
@ezrafarwell393
@ezrafarwell393 4 года назад
Dave / GameDevelopment thank you so much!
@goatedzr354
@goatedzr354 Год назад
for anyone whose gun is still shooting even tho its unequipped, put the code that you put in hte start function in the update function. so it doesnt just exacute that from the start.
@JrMinalga
@JrMinalga 8 месяцев назад
thank you so much
@goatedzr354
@goatedzr354 5 месяцев назад
@@JrMinalga np
@PostVROfficial
@PostVROfficial 3 года назад
How do I add guns? if I add guns the just move with me. pls help
@stevejobs1609
@stevejobs1609 2 года назад
the weapons does unequip and requip however when it unequips it teleports to 0,0 anyone know why? edit: it teleports because my weapon is a melee weapon with animations so once you unparent it, the weapon teleports to the location of the animation. to fix this simply disable the animation on Drop() and enable again on pickup()
@Saud.alhadhod
@Saud.alhadhod 2 года назад
bro ur a life saver like u got no idea i had this issue in January 2021 and i didnt know how to fix it so i switched to unreal engine and made a whole game but now im back to unity tryna make a game but can u give me the script for the animation part like how to deactivate it when u drop the gun and activated it when u pick it up
@stevejobs1609
@stevejobs1609 2 года назад
@@Saud.alhadhod yeah for sure it's like a line ilk go find it
@stevejobs1609
@stevejobs1609 2 года назад
@@Saud.alhadhod full code is this the main thing is saving your animaot component to a variable (mines called anim) and adding anim.enabled=false/true on the drop and pickup functions using System.Collections; using System.Collections.Generic; using UnityEngine; public class test : MonoBehaviour { public weapon gunScript; public Rigidbody rb; public BoxCollider coll; public Transform player, gunContainer, fpsCam; public Animator anim; public float pickUpRange; public float dropForwardForce, dropUpwardForce; public bool equipped; public static bool slotFull; private void Start() { if (!equipped) { anim.enabled=false; gunScript.enabled = false; rb.isKinematic = false; coll.isTrigger = false; } if (equipped) { anim.enabled=true; gunScript.enabled = true; rb.isKinematic = true; coll.isTrigger = true; slotFull = true; } } private void Update() { Vector3 distaceToPlayer = player.position - transform.position; if (!equipped && distaceToPlayer.magnitude
@Saud.alhadhod
@Saud.alhadhod 2 года назад
@@stevejobs1609 thankk u sooo much bro i appreciate it❤️‍🔥
@Xylidine
@Xylidine 2 года назад
@steve jobs omg tysm! i was so confused
@henryat1627
@henryat1627 2 года назад
thanks, after 3 days i finally found this video
@krissytin
@krissytin 3 года назад
Sorry for possibly the silliest of questions but...What if I am trying to do a very basic press E to pick up cube. The cube does not have a script so how do I reference it in script?
@dcry1003
@dcry1003 2 года назад
hey dave question, can this work on melee weapons like swords or knifes and how can i make it so when i throw my melee weapon it also deals damage when it collide?*
@akshit170
@akshit170 4 года назад
Hi, great video! I have a problem that when i put the script on more than one gun then i press E on any one gun the other gun comes to me please help.
@davegamedevelopment
@davegamedevelopment 4 года назад
You need to set the "Equipped" bool correctly before you start the game :D
@akshit170
@akshit170 4 года назад
Dave / GameDevelopment K, thanks a lot
@Kasuga-
@Kasuga- 3 года назад
GunSystem Script is not working. It is showing camshake is missing HELP!
@thisisit.thisishowitends5181
Great tutorial, Dave has the best unity tutorials
@MohamedDZAYZ
@MohamedDZAYZ Год назад
got this problem message System.InvalidOperationException: The TransformStreamHandle cannot be resolved. This Exception was thrown from a job compiled with Burst, which has limited exception support. notice : is use animation rigging in my game 3rd person shooter and the script is working but the player animation not working
@wanbungus
@wanbungus 2 года назад
Hey when i use my pickup script, it works fine as long as the gun is in my camera and set to equipped. Any other weapons just don’t transform to the player when i equip them and im not sure why. i don’t know what’s wrong so if i figure it out i’ll update it here in the comments in case i get no replies
@dewifitradanoadam4956
@dewifitradanoadam4956 Год назад
do you already find the sollution? cause i have the same problem
@halfsqvl204
@halfsqvl204 2 года назад
my gun when i shoot getting smaller how to repair?
@candjim
@candjim 2 года назад
when i pick it up, its rotated wrong. any solution? the guns (grappling gun, ak-47) work fine in it, but when i pick it up, its rotated weird
@wormholeinteractive
@wormholeinteractive 2 года назад
Amazing content and explanations!
@davegamedevelopment
@davegamedevelopment 2 года назад
Thanks!
@dwag2727
@dwag2727 3 года назад
how do i make it able to pick up different weapons? i can only pick up one weapon that is referenced in the script , but i have other weapons, how do i reference them?
@mrreaper2425
@mrreaper2425 3 года назад
Thanks man ur great help for who just start learning XD
@_lonely_3124
@_lonely_3124 3 года назад
im a bit late, but when i made the gun a child of the container, the gun would rotate and aim upwards, i checked the transform and it was the exact same. Also, when i drop my gun, the gun would teleport upwards to a specific place and just float there, i checked through my script and it was the exact same as yours.
@danielmay1846
@danielmay1846 3 года назад
I had the same problem, have you solved this yet please?
@playerplus5917
@playerplus5917 3 года назад
I've the same problem and I still can't fix it. I think he will never respond again :(
@_lonely_3124
@_lonely_3124 3 года назад
@@danielmay1846I think I’ve solved it, if your gun has an animation, when the idle animation is played, it will teleport to the root position (usually 0 0). So, you have to edit the gun drop script so it turns off the animation when it drops, and reenables when picked up. Remember to put the disable animation at the top so it disables animations first before dropping.
@_lonely_3124
@_lonely_3124 3 года назад
@@playerplus5917 I think I’ve solved it, if your gun has an animation, when the idle animation is played, it will teleport to the root position (usually 0 0). So, you have to edit the gun drop script so it turns off the animation when it drops, and reenables when picked up. Remember to put the disable animation at the top so it disables animations first before dropping.
@playerplus5917
@playerplus5917 3 года назад
@@_lonely_3124 I've a grappling gun, but I don't really know *how* to turn off the animations. I tried a lot, but it still teleports to the root position
@official_fishy_games7360
@official_fishy_games7360 Год назад
i need help when i try to pick something up it just teleports and when i drop it it moves and spins before stopping
@ForIEqualsZero
@ForIEqualsZero 2 года назад
HELP!!!!!!!!!!!!! I cant understand why whenever I drop my weapon it goes to the center of the world. pls help me if you know how to fix.
@davegamedevelopment
@davegamedevelopment 2 года назад
Are you using Vector3.zero anywhere in your code?
@ForIEqualsZero
@ForIEqualsZero 2 года назад
​@@davegamedevelopment found the problem! I had two off the same script on the weapon and it made some bugs thank you so much for the help and the amazing videos!!! only one problem the animator is overriding the position of the weapon any idea how to stop it without stopping the animator?
@jadongames777
@jadongames777 2 года назад
can you help me please, for some reason the gun will just shoot into the stratosphere every time i drop it. Please tell me why
@catman7474
@catman7474 2 года назад
so I got a problem that I cant find help for when I look down with my guy it moves the play really fast any ideas
@jubey9366
@jubey9366 3 года назад
I have multiple guns with different gunscripts in my game and I dont know how to reference different gunscripts in one PickUpSystem, so the "public static bool slotFull" still works. Does somebody know how to fix that?
@onlyrxtro7059
@onlyrxtro7059 2 месяца назад
Is it a way to make it to where only I can pick it up and nobody else able to touch it even when I drop it
@alegrjavd
@alegrjavd 2 года назад
Hey, I downloaded the project, but it´s still don´t working. Need I something more?
@davegamedevelopment
@davegamedevelopment 2 года назад
That's weird, the project should definitely work. It could be a Problem if your using a different Unity version since the whole nav mesh stuff is a bit old. If you're using 2022 maybe google for "Unity 2022 NavMesh Setup" or something like that :D
@spiderstudios5032
@spiderstudios5032 3 года назад
Thank you so much! This worked for me! You've earned my sub!
@scribbleraugment9845
@scribbleraugment9845 Год назад
I have encountered a problem, whenever i prees q and drop it teleports to a fixed position
@bigboichungus3744
@bigboichungus3744 3 года назад
ok i need help the script works for the most part i can pick up and drop my guns and they start and stop working when i pick up and drop them but im having this issue where when they are in my hand and i move they move like 2x more than i do so if i move lets say 5feet over to my right the gun will move 10feet (maybe not exactly 2x but you get my point) and they jitter in a way when i move i have everything identical to what is in the video and it still wont work idk what the issue is please if anyone had this issue and was able to resolve it could you help me out
@daselvis5391
@daselvis5391 3 года назад
U solved it now? I have the exact same thing
@sausageswiper2397
@sausageswiper2397 3 года назад
Alright my dude here's the problem, the script works right most of the time. BUT, one of my game objects doesn't seem to be working (from the same asset as the one that works). Here's what happens with the one that doesn't work, when pressing e on the object it gets placed in a weird spot and I didn't understand it (it was placed where the gun container was, but was somehow underground?). SO, I'm like ok lets try making it already equipped. Everything looked fine until I pressed q, instead of being thrown its get places at 0, 0, 0. I've double checked the object with the one that works and I can't figure it out. Any ideas?
@danielmay1846
@danielmay1846 3 года назад
Did you solve this please:) because I have the same problem
@sausageswiper2397
@sausageswiper2397 3 года назад
@@danielmay1846 yes, it had to die with where your animator was
@sausageswiper2397
@sausageswiper2397 3 года назад
Just mess around with which object contains the animator
@nicolaifbving
@nicolaifbving 4 года назад
Hi, I am following your pick-up system but I wanna pick up my gun, without starting the game with a gun in my hand. So walk up empty-handen, pick it up and be able to throw it. Which changes do I need to make? Ty!
@gaminganimator-qp2ir
@gaminganimator-qp2ir 3 года назад
go to th e pick up script and check equipped
@xdmcreamysickalien9067
@xdmcreamysickalien9067 4 года назад
One sentence for this video: YOUR AN ABSOLUTE LEGEND btw can you also make a vid of how to pick up grenade and throw it thank you
@davegamedevelopment
@davegamedevelopment 4 года назад
Haha, thanks so much man! :D Also if you watch my 2 part series on Shooting with Bullets you should be able to make this grenade yourself :D (Just use an invisible gun to throw it :D)
@DAATChannel
@DAATChannel 3 года назад
@@gaminganimator-qp2ir some people don’t know how to script yet
@boogaan8759
@boogaan8759 3 года назад
you explained it that good i even did it in 2D game.
@KryptikChaos434
@KryptikChaos434 2 года назад
Hey so i have a problem where the gun is not equipped however is already attached to the camera so when i go to pick it up, it moves with my camera away from my player, if i set it to where the gun IS equipped then wherever ive put the gun, whether its in my players hand or not, it will still follow my camera, this stops once ive pressed my pick up bind and dropped it.. THEN it works normally. Any Help on this?
@atomicalex1732
@atomicalex1732 4 года назад
PLEASE help for some reason my weapons size or rotation is always messed up when i pick up my weapon please reply soon, im in a game jam
@davegamedevelopment
@davegamedevelopment 4 года назад
That means your gun container isn't set up right, if your gun is inside of the container it should have exactly this values: Position (0,0,0) Rotation (0,0,0) Scale (1,1,1) Then everything should work fine :D
@atomicalex1732
@atomicalex1732 4 года назад
@@davegamedevelopment thanks!
@potatogamer395
@potatogamer395 10 месяцев назад
hello bro I have written all the code but when i play the game And go near the gun and press W but it flies above on Y axis for some reason
@dewifitradanoadam4956
@dewifitradanoadam4956 Год назад
where i should put the second gun?? does the second gun would be in the gun container or??
@Rayangoselink
@Rayangoselink 3 года назад
Dani aproves about the player object
@Daniel-qu5xd
@Daniel-qu5xd 4 года назад
Hello so when I pick up a first gun it is normal but when I drop it, I can still shoot with the dropped gun. Then I equipped the second gun and I could still shoot with both gun, could you help me please? (I used your exact script)
@davegamedevelopment
@davegamedevelopment 4 года назад
Did you set the equipped bool correctly before the start of the game? For the one in your hand it should be true and for the one on the ground false
@John-jg4wp
@John-jg4wp 3 года назад
Hi! so im having issue that when i hit E the object goes to the grab slot but doesn't parent and it throws me a "MissingComponentException: There is no 'Rigidbody' attached to the "player" game object, but a script is trying to access it. You probably need to add a Rigidbody to the game object "player". Or your script needs to check if the component is attached before using it." error, if anyone could help that would be great!
@developer2
@developer2 3 года назад
it's pretty straightforward, add a rigidbody to your player. if your player starts glitching then set it to kinematic
@papichinomino
@papichinomino 4 года назад
I’m trying to use this with danis grapple gun and it’s just blatantly not working when I move the whole thing just shifts it’s position, and when not equipped it would hit the ground and pause through it I think
@davegamedevelopment
@davegamedevelopment 4 года назад
It should work, the most important thing is that you delete the spring joint (grapple hook) on your player when you drop the gun. And maybe download the project file to see how everything is set up (there the gun shifting is fixed)
@papichinomino
@papichinomino 4 года назад
Thanks
@discocat9431
@discocat9431 3 года назад
@@papichinomino How did u fixed it. I use dani's code for the grapling gun and when i walk the gun walks too like when i go left the gun changes its position
@Papa_Tin
@Papa_Tin Год назад
The problem I'm facing is that the gun is thrown correctly the first time, but once I pick it back up it throws from near my feet? Not sure why to be honest with you, any help is appreciated
@tanphuquangxuan.1854
@tanphuquangxuan.1854 5 месяцев назад
when i add rigidbody to the gun the gun doesn't follow the player help
@YusafAnimations
@YusafAnimations Год назад
Brooooo is anyone else having this problem, i press e and it picks up the weapon, it looks fine but as soon as i move the character starts glitching, not moving in the right direction and most of the time it just phases through the map, ive played with all the rigidbody controls, tried many varients which caused many glitches and the least glitchiest is the extrapolate and continuous speculative which is where i just fall through the map. the worst part is that the arrow keys get mixed for some reason, so up is left, down is making him fly, right makes him go backwards, etc etc etc etc. its just weird and idk if its the tutorial or my movement script, which i also worked on and played with to see if it was the problem, and i put my my movement and camera look parts of the script in normal update instead of fixed update... yeah obviously it didnt work just did the same thing so any ideas on how to fix this? should i get a new movement script? does anyone have a better fps tutorial???
@alvinopingvino4584
@alvinopingvino4584 4 года назад
it dosent work dor me i cant pickup and the thing i have in my hand ben launced away i have removed the gunscripet cuse i dont have a gun but pls make a tutorial on pickup/drop items only
@davegamedevelopment
@davegamedevelopment 4 года назад
Maybe download the project file I used over my discord server, there you can see how everything is set up and do it the same way :D For Items you only need to remove the part with deactivating the gun script, the rest should be the same :D
@koki10190
@koki10190 4 года назад
I do that with raycast
@AZASeraph
@AZASeraph 2 года назад
What if I have multiple gun scripts?
@NeroThePlayed
@NeroThePlayed 2 года назад
i get an error cs0246 the type or namespace name "gun" could not be found (are you missing a using directive or an assembly reference?)
Далее
They Dared Me To Make A Game...
12:08
Просмотров 1,1 млн
How to Pick Up + Hold Objects in Unity (FPS)
3:42
Просмотров 26 тыс.
FULL 3D ENEMY AI in 6 MINUTES! || Unity Tutorial
5:52
Просмотров 631 тыс.
AI Learns to Run Faster than Usain Bolt | World Record
10:22
I Tried Illegal Minecraft Mods
20:15
Просмотров 1,6 млн
How to Collect Items (Unity Tutorial)
14:23
Просмотров 59 тыс.
I Paid Fiverr Game Developers to Make the Same Game
10:25