After one hour of tears and headsmahes i found this video and the title saved my life... i didnt use 2D... Even tho i used 2D components hundrets of times in the past... Its 4 AM now and i can peacefully go to sleep, tyvm.
@@RomainDelmaire I'm sorry if my comment meant shaming. it was not the intention. I soon realized how important Physics and Maths are to Game development.
@@nathanmcconnell9991 In physics, you learn about Rigidbody. Some of the requirements when you go to uni to learn game programing is Physics and maths.
Some call him The Next Brackeys Others call him a Legend I call him "The man that the saved me from starting a new project by ACTUALLY making a good Tutorial about Collisions "
I needed this so badly for a long time. I am so happy to finally discover your channel as it is truly inspiring work :) Thank you for everything you have contributed to the unity community Code Monkey!
Thank you so much, I have been working on my first game ever. Even though it is a 3d game this finally got a object to detect the thing- THIS SAVED ME SO MANY HOURS.
This is a really good tutorial, because it does not only show one way to do something and is over, but it covers several ways how to do and how not to do the topic the video is about. This makes things easier to get put together inside the brain of someone watching. Good work.
I made a project and the walls were not working, then I permanently deleted the project and made a new one and I felt like to quit on this idea, but then you cam and saved me from rewriting 567 lines of code. love u Thanks :D
I was looking to learn more about collisions, but what ended up really helping me on the video was discovering the Rigidboy2D.MovePosition function, which made me found out the solution to my player movement. I was doing it using the transform before, which wasn't working properly when moving towards terrain
Hay code monkey bro i frickin love you omg you saved me actully i needed the function on collision exit and i was not knowing that this finction even exists bro i was almost going to quit my game but you saved it bro i am sooo frickin glad i found your vid
Thank you so much! I have been trying to make a title screen, and the trigger wasn't working. I found this video 30 minutes after midnight, and it allowed me to go to bed.
Awesome video ,I really understand the concepts of collisions better now. Can you also make more on 3d development that would be really helpful Thanks,love your videos
Man, I had the same problem, I was trying to play an animation trigger with just the collider, when I tried this, I almost make you a coding religion, haha. Thanks man.
OnVoidStay2D That line of code saved me! I was trying to make an attack for my character, it is a sword slash, due the circunstances i had to use the Polygon collider as a trigger, then it was simple, i would press the button, if it detected an object with the enemy tag in range it would play the damage animation while removing a life point. The problem was: i didn´t read the whole Unity manual so the only OnTrigger/OnCollider i knew was OnTriggerEnter, from here you can guess the problem. Really stupid of my part....
Thanks for this, I needed this tutorial today, I was doing colliders and triggers were set up perfectly, the only difference was my Player never had a rigidbody, so weird that it needs that.
Hello, great video but i didn't manage to solve my problem, was wondering if i could have some of your time. Currently, my player has the following components: transform, renderer, animator (custom script), rigid body 2D, box collider 2D as well as a movement script. The tilemap i want the player to interact with has: tilemap, a renderer, tilemap collider 2D. All these components have their default settings (eg: the player is a dynamic object not kinematic), and my problem is very odd, my player can walk across the floor, will 'hit' the ceiling and not go any higher, but for some reason can pass through the tiles left to right; so my problem is that the x axis collisions are working (as i can walk on them), but my y axis doesn't seem to (as my player can pass through them when walking left to right). Thank you for any help, James
thank you for the tutorial, do I need to use RigidBody2d to make it stop against walls? right now i am using a joystick prefab, and in the code using: player.transform.position, and I set an object, just a black cube, with only box collider 2d, and the player still goes through it... so again, is it because I am using transform.position instead of Rigidbody2d? I set everything you did at the 5:51 video mark.... but not working.
The rigidbody by itself has no shape, the shape is on the collider. So just a rigidbody will move through walls If you manually set the transform.posiiton then you're overriding the rigidbody logic (unless you make it kinematic but then you have to handle collisions yourself)
Really cool video, but I have a problem. If I want one object to collide with something and also to be trigger to something, how can I achieve this? (for example a projectile that bounces off the walls but effects the player as trigger)
Love your videos. They help me a lot. I'm having a problem now and I dont know how to find a solution. I need to detect areas in a sphere with mouse click, like a globe. Do you know how I can do that?
@@CodeMonkeyUnity Oh nice! I'll check that. Thank you! So what I need to do is include a collider for each region I want to detect on the sphere and put all as sphere children?
@@stakes_z Yes, if you have your globe with separate mesh parts that you want to select, just add a Mesh collider to each part. Then when when you click you can just do a raycast if you want to test a single point ruclips.net/video/0jTPKz3ga4w/видео.html Or use Physics.OverlapSphere if you want to test with a bit of range
Hi. I would just like to say that it worked. I took meshes for each region of the map, put a mesh collider on each one and used your tutorial on clicking 3d objects as a base. Thank you very much! :D @Code Monkey
Confused about collisions? This video will help! 🎮 Play 7 Awesome Games (Action, Strategy, Management) and Help Support the Channel! ✅ Get the Game Bundle 67% off unitycodemonkey.com/gameBundle.php
After one hour of tears and headsmahes i found this video and the title saved my life... i didnt use 2D... Even tho i used 2D components hundrets of times in the past... Its 4 AM now and i can peacefully go to sleep, tyvm.
aaand you just saved me
@@data_corrupted i think you might need to fix your data.
I almost quit my first game after 3 days of tweaking the code, turns out it only needed a rigidbody, damn, I owe you one a big thanks
If you learnt Physics and mathematics well in High school, You will know the engine better.
@@junejuly532 Don't shame someone on what they didn't learn. Encourage them for what they are learning.
@@RomainDelmaire I'm sorry if my comment meant shaming. it was not the intention. I soon realized how important Physics and Maths are to Game development.
@@junejuly532 Knowing physics and knowing you needed a RigidBody in Unity are not the same thing.
@@nathanmcconnell9991 In physics, you learn about Rigidbody. Some of the requirements when you go to uni to learn game programing is Physics and maths.
Some call him The Next Brackeys
Others call him a Legend
I call him "The man that the saved me from starting a new project by ACTUALLY making a good Tutorial about Collisions "
My man, I spent like 45 minutes trying to figure this out. Was missing the all important 2D at the end. Thanks much!
I needed this so badly for a long time. I am so happy to finally discover your channel as it is truly inspiring work :) Thank you for everything you have contributed to the unity community Code Monkey!
I'm glad the video helped you! Thanks!
I searched on many videos and websites, and now I finally found how to make the player not pass through the walls
,Thank you!
Thank you so much, I have been working on my first game ever. Even though it is a 3d game this finally got a object to detect the thing- THIS SAVED ME SO MANY HOURS.
I'm glad the video helped!
OH MY GOD 2 HOURS OF PAIN BECAUSE I DIDNT HAVE A RIGID BODY.
In all seriousness this tutorial was a life saver, sending love man ❤
heh I'm glad the video helped you! Thanks!
This is a really good tutorial, because it does not only show one way to do something and is over, but it covers several ways how to do and how not to do the topic the video is about. This makes things easier to get put together inside the brain of someone watching. Good work.
Thanks! Glad you liked it!
I made a project and the walls were not working, then I permanently deleted the project and made a new one and I felt like to quit on this idea, but then you cam and saved me from rewriting 567 lines of code.
love u
Thanks :D
I am a simple man, I see Code Monkey and I like it.
Aynen :)
Man you stole my line, :) But yes we both are simple men for sure
@@iDigvijaysinhG Sharing is caring, right?
2 years later and still saving lives, great tutorial saved me a lot of time :)
Your channel is very good, your English is very clear and the speed that you speak is very nice, helpful for those non-natives
I was going mad trying to get OnTriggerEnter to work, you're awesome!
I see a fellow Bread, alliance??
Thank you :) After 5 hours of finding the problem I've finally fixed it
OHH! THANK YOU!
my mistake is that I was actually using OnCollisionEnter insted of OnTriggerEnter! never notice this till now =-=
mine is OntriggerEnter instead of OnTriggerEnter... been spending hours for a spelling mistake T _ T
@@iamyourfather6941 haha! that's C# for yah
I f***ing love you man, you have saved me
I was looking to learn more about collisions, but what ended up really helping me on the video was discovering the Rigidboy2D.MovePosition function, which made me found out the solution to my player movement. I was doing it using the transform before, which wasn't working properly when moving towards terrain
very clear explanation, thank you so much, now I can fully understand differences between these kind of collisions!
Found you through the ads and really liking your videos. Subscribed
Glad you like the videos!
Thank you for the help. I was struggling a lot to make the collider work but now it works. I am new to unity and C# and you are of great help.
Hay code monkey bro i frickin love you omg you saved me actully i needed the function on collision exit and i was not knowing that this finction even exists bro i was almost going to quit my game but you saved it bro i am sooo frickin glad i found your vid
o m g, i freaking love you, i have been looking for solution for so long and no one says about rigidbody2d XDDD
I was going crazy... could not get a state change inside the trigger. Watching the debugs you used solved my problem lol!! Many thanks!!
You are actually so cool. Thank you so much for all of these amazing tutorials you are producing. :)
Thanks bro it was helpful... First I thought my script was wrong and deleted it and wrote again and again deleted... But now it's working
THANKSSSSSSSSSSSSSS MAN YOU JUST SAVE ME, I WAS 6h ON THIS
bruv I was giving up making a (TOP DOWN DODGER) game because of the rigidbody :)
I just subbed to the game dev god
Thank you so much! I have been trying to make a title screen, and the trigger wasn't working. I found this video 30 minutes after midnight, and it allowed me to go to bed.
THANK GOD IT WORKS YOU ARE A GENIUS
I'm glad the video helped!
if I had 3 wishes, my first wish will that you will have a million subscribers
Thank you!
Amazing, solved my problem super quickly. Love you!
I'm glad thte video helped you!
Thanks Code Monkey You Really Helped Me A Lot!
Thank you, my game really coming along, I just added split screen multiplayer
This was very helpful. You're the 🐐
Awesome video ,I really understand the concepts of collisions better now.
Can you also make more on 3d development that would be really helpful
Thanks,love your videos
Thank you so much!!! I was finding the way that can solve the problem which is first explained in your video! Thank you!!
Helped me a lot! Looking forward for your game on steam!
Thanks very much! This tip saved my work, congratulations!
THANK YOU!! It got stuck at this problem for over an hour.
Amazing as always.
Bro thank you, i so confused when i making, but you explain this. Thank You
Man, I had the same problem, I was trying to play an animation trigger with just the collider, when I tried this, I almost make you a coding religion, haha.
Thanks man.
THANK YOU turns out i just needed 2D at the end. thanks lots
Thank you for this video, I was stuck wondering why my collisions wouldn't work.
Life saver always, Thanks Hugo :)
Your teaching ability is quite exceptional 👌👌👌👌👌👌👌
I really love it💖💖💖💖💖
Thanks as always uploading Such information viedo 🙏🙏🙏🙏🙏🙏
This was really really helpful, thank you very much!!
Nice!
You saved my team
I'm glad the video helped you!
Code Monkey saves the day again! woop thx man!
OnVoidStay2D
That line of code saved me! I was trying to make an attack for my character, it is a sword slash, due the circunstances i had to use the Polygon collider as a trigger, then it was simple, i would press the button, if it detected an object with the enemy tag in range it would play the damage animation while removing a life point. The problem was: i didn´t read the whole Unity manual so the only OnTrigger/OnCollider i knew was OnTriggerEnter, from here you can guess the problem. Really stupid of my part....
Thank you so much for this video !! Really helpful!!
I'm glad it helped you!
Love your Tutorials . Awesome and simple explanations
Keep up the great work buddy. I wish you success and more of it.
you make my day ... thank you !!!
Nice! I was using a 3d collider for 2d game, thanks for helping! :)
Ты легенда. Спасибо за детство
This is very helpful, I Subscribed :)
Very helpful and great explanation, thanks man
you literlly safed my life
you save me again! thanks from brazil
Thanks for this, I needed this tutorial today, I was doing colliders and triggers were set up perfectly, the only difference was my Player never had a rigidbody, so weird that it needs that.
increible Thanks CodeMonkey:D
Great work and you're so excellent! Helped me a lot.
Thank you for this video!
Thank you! You saved my life!
broooooooooooooooooooo,thank my gooooooooooooooooood,really i mean it you are an absoulte lifesaver
I'm glad the video helped you!
So helpful, thank you as always!
Great tutorial! Thank you so much!
Saved me... my hero!
I'm glad it helped!
I WAS SEARCHING FOR THIS FOR HOURS YOU SAVED MY COMPUTER FROM ME XDD
I'm glad you found it helpful!
Dude I had everything right except I was using OnTriggerEnter instead of OnTriggerEnter2D! Thanks!
Nice, I found the issue with mine being that I was using the 3d collision and not 2d! Only figured out when I copied your code out by hand lol
Yup I've made that mistake myself several times when I was a beginner
Hello, great video but i didn't manage to solve my problem, was wondering if i could have some of your time.
Currently, my player has the following components: transform, renderer, animator (custom script), rigid body 2D, box collider 2D as well as a movement script. The tilemap i want the player to interact with has: tilemap, a renderer, tilemap collider 2D. All these components have their default settings (eg: the player is a dynamic object not kinematic), and my problem is very odd, my player can walk across the floor, will 'hit' the ceiling and not go any higher, but for some reason can pass through the tiles left to right; so my problem is that the x axis collisions are working (as i can walk on them), but my y axis doesn't seem to (as my player can pass through them when walking left to right).
Thank you for any help,
James
thank you for the tutorial, do I need to use RigidBody2d to make it stop against walls? right now i am using a joystick prefab, and in the code using: player.transform.position, and I set an object, just a black cube, with only box collider 2d, and the player still goes through it... so again, is it because I am using transform.position instead of Rigidbody2d? I set everything you did at the 5:51 video mark.... but not working.
The rigidbody by itself has no shape, the shape is on the collider. So just a rigidbody will move through walls
If you manually set the transform.posiiton then you're overriding the rigidbody logic (unless you make it kinematic but then you have to handle collisions yourself)
cheers! my issue was using OnTriggerEnter instead of OnTriggerEnter2D :)
thank u man, u solved my problem
I'm glad the video helped! Thanks!
Thank you King
I LOVE YOU !!! THANK YOU
you save my life!
That's great to hear! Thanks!
Very informative thanks
Man, i f****** love you
Really cool video, but I have a problem. If I want one object to collide with something and also to be trigger to something, how can I achieve this? (for example a projectile that bounces off the walls but effects the player as trigger)
+
Thanks! ;)
Thanks, very useful
Bro u r the best
Great video, thanks . I wasnt getting any output from the OnTriggerExit function due to I was testing collision vs collsion2d
THANK YOU!
Love your videos. They help me a lot.
I'm having a problem now and I dont know how to find a solution. I need to detect areas in a sphere with mouse click, like a globe. Do you know how I can do that?
You can use Physics.OverlapSphere(); or Physics2D.OverlapCircle();
It will find all objects will colliders within range
@@CodeMonkeyUnity Oh nice! I'll check that. Thank you! So what I need to do is include a collider for each region I want to detect on the sphere and put all as sphere children?
@@stakes_z Yes, if you have your globe with separate mesh parts that you want to select, just add a Mesh collider to each part. Then when when you click you can just do a raycast if you want to test a single point ruclips.net/video/0jTPKz3ga4w/видео.html
Or use Physics.OverlapSphere if you want to test with a bit of range
@@CodeMonkeyUnity Awesome! Thank you so much! I'll create my globe with multiple meshes and try it. Thank you
Hi. I would just like to say that it worked. I took meshes for each region of the map, put a mesh collider on each one and used your tutorial on clicking 3d objects as a base. Thank you very much! :D @Code Monkey
3:08 - legend says this is the moment a young naive man somewhere west in brazil raged with the intensity of a thousand Suns.
Are you talking about yourself?
Thanks dude!!! you save me :D
Thanks bro you saved me
Thanks
your typing speed is faster than light omg
God bless you!!
Awesome!
Nice thank you :)
OMG thanks for this video my only problem was the little "2D" you need to add after OnTriggerEnter and the collider
Same here
Shitttt i didn't realised there was a 2d trigger tooo thank u mannnn 😭 u saved mee i didn't even noticed in video damnnn thnxxxx
Confused about collisions? This video will help!
🎮 Play 7 Awesome Games (Action, Strategy, Management) and Help Support the Channel!
✅ Get the Game Bundle 67% off unitycodemonkey.com/gameBundle.php
Thanks code monkey for helping us..