How to Pick up and Drop Objects/Items! (First and Third Person, Unity Tutorial)

preview_player
Показать описание
👍 Learn to make awesome games step-by-step from start to finish.
👇 Click on Show More

🔴 RELATED VIDEOS 🔴

💬 Learn how to Pick up and Drop objects. Very easy to use, just attach the component to any object and you can easily grab it. Technically it works on anything so you can pick up a simple Muffin or a giant Car.
Stay tuned for the next video where I will use this in remaking a really interesting unique crafting system like in Hydroneer!

📝 Some Links are Affiliate links which means it costs the same to you and I get a nice commission.
🌍 Get Code Monkey on Steam!
👍 Interactive Tutorials, Complete Games and More!

If you have any questions post them in the comments and I'll do my best to answer them.

See you next time!

#unitytutorial #unity3d #gamedev

--------------------------------------------------------------------
Hello and Welcome!
I'm your Code Monkey and here you will learn everything about Game Development in Unity using C#.

I've been developing games for several years with 8 published games on Steam and now I'm sharing my knowledge to help you on your own game development journey.

I do Unity Tutorials on just about every topic, Unity Tutorials for Beginners and Unity Tutorials for Advanced users.

--------------------------------------------------------------------
- Other great Unity channels:
--------------------------------------------------------------------
Рекомендации по теме
Комментарии
Автор

So ...
does anyone else just watch random videos from Code Monkey?
I'm just taking a break from working on a project (brain is melting). It's kind of like shopping, you would be surprised at all the things you didn't know you needed until you saw it sitting there on a shelf lol. Thankfully unlike most of my random shopping trips, I don't leave here feeling broke and guilty lol.
Thanks for everything you do man, its muchly appreciated.

michaelwilson
Автор

nice video as usual,
I like how you always make use of the starter assets

alienouz
Автор

This is Super cool. 💯👍🏻

Making your 3D Character able to grab objects (items, swords, etc) is an important part of the fun, in GameDev.

Thank you for sharing your knowledge with us.

alec_almartson
Автор

Your tutorials are always so helpful, thanks a lot

Liam_The_Great
Автор

Thanks Code Monkey, this helped me with my pick up feature I was implementing in my game!

aaronsgaminggarage
Автор

GAH! I was hunting for a null exception error for over an hour; turns out I had an extra set of curly braces after the line
"if(Physics.Raycast(playerCameraTransform.position...", had to scroll over to see them!
If you're getting a null exception error, watch out for those braces!

Great tutorial, thanks for your work!

alexanderoneill
Автор

Thanks for the cool tutorial! I noticed you did some if/else nesting. Might I suggest you have a look at quick returning/return early pattern. It was a real eye opener for me, and made my code much clearer to read, for me and my colleagues. Keep up the good work!

MarkVinkNL
Автор

Awesome tutorial as always and useful for my current uni project :)

BNTO
Автор

Ive been looking for this everywhere...
I love you code monkey 💪😖💙💙💙

geengee
Автор

Whoever's reading this, i pray that whatever you're going through gets better and whatever you're struggling with or worrying about is going to be fine and that everyone has a fantastic day! Amen

YoMateo.
Автор

I notice in a lot of your tutorials, you'll make local variables (like in this case the pickup distance and lerp speed) to have the flexibility of changing the values; but why not just make them serialized fields since you have other serialized fields already?

MarushiaDark
Автор

Hi, I watched most of your videos. I'm making a game from a tps perspective by playing with your codes. Basically it works like this: When the character presses e, he can pick up the object the crosshair is on and move it, but there is a bug. If I approach the wall and press A and D or make any turn movement, the box gets stuck between the character and the wall collider and passes through the wall. How can I fix this?

Thefec
Автор

Thank you sir, this tutorial helped me alot 😃

SwayamVaza-qrvs
Автор

No matter what I do my item is still extremely jittery. Can you suggest any other solutions to try please?

jankystreams
Автор

the next tutorial can be the ones with the area where you can sell items when you put them in that area?

vipex
Автор

great video and very good explanation, thanks

supertenchoo
Автор

For anyone who still thinks its to jittery, change the fixed update to this: private void FixedUpdate()
{
if (objectGrabPointTransform != null)
{
float lerpSpeed = 10f;
Vector3 targetPosition =

// Smoothly move the object towards the target position
objectRigidbody.MovePosition(Vector3.Lerp(transform.position, targetPosition, Time.deltaTime * lerpSpeed));
}
}
You're welcome :)

o
Автор

Tutorial uses old input system, putting code in a use defined function instead of update allows it to be called and used with new input system performed action.

joshsheppard
Автор

hello just wanted to tell you that the layer mask didnt show the player, so i would hit the player instead of the obect, so i removed the layer mask part from the code and it works fine

Ignaciodev
Автор

Trying to implement the idea of picking up a container (e.g. the cart) that has other grabbables inside, but since "Non-convex MeshCollider with non-kinematic Rigidbody is no longer supported since Unity 5." the container has to have a convex collider and ends up behaving like a box. :( Making the container kinematic makes it fly through things (terrain included) so not an option..

MummyfiedRose