Тёмный

Unity Top Down Colliders and Character Movement - Tutorial 

CouchFerret makes Games
Подписаться 29 тыс.
Просмотров 196 тыс.
50% 1

We will add collider and rigidbody components to our walls to make sure that our Player can't go through walls in our Top Down Unity Game. We will also improve our Character's Movement to a Physics-based one with velocity. We will also talk about the Composite Collider and I will show you how you can merge colliders together with it.
Are you interested in making games with Unity?
I upload every Saturday, so stay tuned and consider subscribing!
Hi, I'm CouchFerret and follow me on my journey of indie game development. You will find WEEKLY in depth tutorials about developing games in Unity. We will cover topics from programming to art and game design. Whether you are an expert or beginner, you will definitely find new tips and tricks about the whole game development process. These how to videos help you learn unity to develop 2d and 3d games on your own
#Unity #UnityTutorial #gamedev

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

 

27 сен 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 160   
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
*Hey everyone!* 👏 👏 I'm happy to announce our community *Discord server* , come and *join us* : discord.gg/dac7sr2 And also, you can get all the *Sprites* and *Project Files* by supporting me on *Patreon* : www.patreon.com/CouchFerret
@Kapteeni40
@Kapteeni40 15 дней назад
This is the best movement + collision tutorial on RU-vid, I swear! It has examples, illuminating art; everything!
@mayankkela8485
@mayankkela8485 5 лет назад
CouchFerret you are a professional Developer who simply work And couch easily You are a nice Developer
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
Thank you! :)
@CulturalToast
@CulturalToast 5 лет назад
Love your "webcam" and new style of explaining
@TheAncester
@TheAncester 5 лет назад
Nice new addition with the 8bit ferret and accommodating description visuals man!
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
Thank you! :) I wanted to make it a bit more entertaining.
@albingrahn5576
@albingrahn5576 5 лет назад
I love the pixel drawings that explain things!
@aryaiskandarsyah
@aryaiskandarsyah 5 лет назад
thank you so much, your channel is beginner friendly :D. and you did alot of edit on your character on the screen. this channel must become popular like brackeys :D
@jemma.maurice
@jemma.maurice 4 года назад
This ain’t quality content This is high quality content
@phi6669
@phi6669 4 года назад
thx man, I sat in my chair almost with tears in my fckn eyes cause I have to show my Project to my teacher in a few days and i was so done with my life lol
@hulm
@hulm 5 лет назад
Man, I am just happy for finding this channel 😃
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
I'm happy too! 😃Welcome to my channel!
@xkondi5434
@xkondi5434 5 лет назад
You put your heart into your videos, because of that it feels awesome to watch them and learn from them too :)
@BenanaBoy
@BenanaBoy 4 года назад
Seriously underrated channel
@a_soulspark
@a_soulspark 5 лет назад
The little 2D Ferret is lovely! Also, how hard would it be to add jumping in this game?
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
Hey, thanks! :) Well, it depends on what kind of jumping you are talking about. If it's a tumble like dodging arrows fast, then it's pretty easy and I'm planning to do that. However, I have a feeling you are thinking about real jumping like between platforms an such. It remains simple as long as the overall world of the game is flat. Like in this game, the map is flat and there are no hills, the "terrain" is flat. But if you want to have hills or platforms that are taller to jump in between them, then it becomes very cumbersome in this game's full 2D solution. And I would recommend a 3D isometric solution with the same sprites. You couldn't tell the difference in looks. It's a bit harder to implement the basic mechanics but handles the 3D space way better (because it's literally 3D) so any kind of jumping would be possible to implement. All in all, if your jumping remains in a flat world then it's easy, but if it requires upwards and downwards motion in a 3D space like in Monument Valley, then this 2D solution makes it hard and not feasible.
@hauntedcrowdev
@hauntedcrowdev 7 месяцев назад
I was struggling a bit with this! Thanks for this guide!
@BulkyDookieVODS
@BulkyDookieVODS Год назад
This Video Saved Me!!! I've been trying to figure out how to collide a "Character" to other GameObjects using a Non-Physics "Transform" method in script. I didn't know you could use RigidBody2D like this LMAO!!!!!
@pratikdhanawate8648
@pratikdhanawate8648 2 года назад
Really helped in solving the problem that got me stuck on not one but two games
@viz.9649
@viz.9649 2 года назад
Thanks for the clean tutorial, man. Saved my future
@JoaoAntonioCardoso
@JoaoAntonioCardoso 5 лет назад
The composite collider is really a great technique that I didn't know - could save a lot of trouble... haha very good videos!
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
I've found it not long ago, such a great component. :P Solves all the previous problems.
@TheIslandIdiot
@TheIslandIdiot 4 года назад
you deserve more subscribers and views! this is great!
@iansong1676
@iansong1676 5 лет назад
Another awesome video! I love you little animations on the side. Also thank you so much for going over Time.deltaTime! It really helps me a lot.
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
I'm glad you liked it. ^ - ^ I think I'll mention Time.deltaTime and stuff like Update() FixedUpdate() more in the future. They are just such frequently used things.
@milanstevic8424
@milanstevic8424 5 лет назад
when you get the hang of it I'd also recommend writing your own wrapper for the delta time in general. that'll put you in much more control over the time flow in your game. as an example, while setting time scale to 0 is useful to pause the game, it would also freeze all of your animations in place (because they rely on this scaled delta time), and you'd probably want to keep some of them in your pause menu. you could also use the so called unscaled delta time, but oh boy, rolling your own is always much more handy. and can be fun as well.
@ldvata7609
@ldvata7609 7 месяцев назад
Earned a sub
@freemind.d2714
@freemind.d2714 5 лет назад
watch so many video, this one finally helped
@SixGunsTV
@SixGunsTV 5 лет назад
thanks for ur amazing help!
@narrenschlag
@narrenschlag 5 лет назад
That is so great. Why haven't I found you earlier :D
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
Thanks! I’ve been playing hide and seek on RU-vid, that’s why. :D
@redhawkrobin
@redhawkrobin 2 года назад
This was a pretty awesome tutorial!
@kjp312
@kjp312 5 лет назад
Helped me a lot
@kamilniezorawski7244
@kamilniezorawski7244 5 лет назад
Great tutorial, thank you
@javiaguilar1156
@javiaguilar1156 5 лет назад
Very well explained tutorial. Could you make a follow-up tutorial on how to restrict the player movement to the grid? Like in old games like Pokemon Gold and Silver, where each time you press a direction the player moves exactly 1 cell in that direction. Thank you
@sgt2615
@sgt2615 5 лет назад
This helped me so much, Thanks
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
I'm glad it helped! :)
@kamilstudios
@kamilstudios 3 года назад
Awesome tutorial!
@Moon-to9se
@Moon-to9se 2 года назад
Thank you so much!
@WolfieMoonDev
@WolfieMoonDev 3 года назад
Would you be able to do vs code tutorials to?
@edsu7898
@edsu7898 2 года назад
thank you very much your a great game dev
@faithmorante
@faithmorante 2 года назад
This helped me alot thanks!!
@vsr3276
@vsr3276 5 лет назад
Great tutorial series! I have a question tho, will you make this online multiplayer or local? I subbed to you btw
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
I only have plans for local multiplayer. It would be fun to have online multiplayer, but it would take a lot of time to get it right, and with that time I could develop the next game instead. :) Thanks for the sub, and welcome to my channel! ^ - ^
@ethanbeers7497
@ethanbeers7497 2 года назад
how do i get my character to be behind the object when he moves behind it instead of just walking thru it. im talking about outside of the box collider but supposed to be behind the object
@LarS22730
@LarS22730 5 лет назад
fantastic tutorial man! great improvisation when explaining. maybe next time you need to make more lil bit entertainment in the tutorials like a joke or something to make it not too boring 👌
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
Thanks! Yeah, I'm thinking about the entertainment part of the video a lot. I don't want to have you guys to fall asleep. :D But because I write the scripts for the voiceover beforehand, and I'm not an actor :D the little jokes doesn't really end up being good in the end. I plan to go off script soon, let's see how it will go. :)
@LarS22730
@LarS22730 5 лет назад
@@CouchFerretmakesGames heck yea, gdluck with that ' w')b
@xxashleythefoxx6765
@xxashleythefoxx6765 5 лет назад
Thank you your a Lifesaver
@MycoalD
@MycoalD 4 года назад
thanks, this helped!
@게임개발흥미
@게임개발흥미 5 лет назад
amazing!!
@Andrew90046zero
@Andrew90046zero 5 лет назад
Why do the walls need a kinematic rigid body? If they are static, wouldn't they not need to move? Or does giving them kinematic bodies help with something? EDIT: I noticed you eventually removed them, but you then had to put a rigidbody in the grid object, which is still a bit odd.
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
You are right! The individual walls didn't need to be kinematic they could have remained as static objects. I messed it up, I'll make sure to have a dedicated episode on the collision matrix to sort this out once and for all. :) Thanks for pointing it out! Odd, I know, but the CompositeCollider requires a RigidBody2D component. It was strange for me as well and I tried to remove it, but no luck.
@clementiine4422
@clementiine4422 5 лет назад
is there anything i can use other than unity?
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
Godot is a good and free alternative, but you could use most of the game engines out there probably.
@clementiine4422
@clementiine4422 5 лет назад
ok thanks!
@henrymontalvo384
@henrymontalvo384 2 года назад
How do you make it so the player can appear above the wall when below it and behind it when above in 2D?
@mayankkela8485
@mayankkela8485 5 лет назад
Thanks you couchFerred
@siddharthsen4475
@siddharthsen4475 5 лет назад
Thanks
@The5thAstronaut
@The5thAstronaut 5 лет назад
my player has a rigidbody2d and box collider while my 'buildings' tilemap has the tilemap collider 2d, but my player still walks over the building tiles. Is there anything else I should watch out for? Or something I'm missing? They're both on the same sorting later, and the same blocking layer and my players body type is kinematic.
@tony_gvrd
@tony_gvrd Год назад
mine too :(
@jackripper7578
@jackripper7578 3 года назад
My respect
@ramicky16
@ramicky16 5 лет назад
Hello! Thank you for your work! I have a question though :o What about a body of water.. I don't want it to kill the player I wanted it to block the player just like a wall.. but The player is supposed to open a bridge that goes through the water.. do i make 2 separate game objects for the water with different colliders or is there a smarter way?
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
I think I would go for the 2 separate game objects, or even 3. The third one begin the bridge which will be turned of if the player has opened the bridge.
@shockingshinx12
@shockingshinx12 4 года назад
I'm still having the issue where the character bounces back from the walls even after adding that line of code in the script?
@goingsillymode
@goingsillymode 3 года назад
i'm having the same problem, did you ever figure out how to fix it?
@shockingshinx12
@shockingshinx12 3 года назад
@@goingsillymode No I did not, sorry
@goingsillymode
@goingsillymode 3 года назад
@@shockingshinx12 alright, thanks anyways!
@letsplaynay9936
@letsplaynay9936 4 года назад
When my character touches the colliders, my background rotates? why is this?
@LaCreArthur
@LaCreArthur 4 года назад
Really nice explanations with your illustrations. A bit slow paced for me but with 1.5x speed it's perfect :)
@tuke4202
@tuke4202 4 года назад
The collision doesnt work for me if i have kinematic
@kiwioverlord9519
@kiwioverlord9519 5 лет назад
Hi CouchFerret, it's been forever since I asked you for help not because I've stopped programming, but because you answered all my old questions so well that I've been doing just fine! :D Anyway, lately I've had a more technical problem: you know how if you make a gameobject, object A, the child of another gameobject, object B, then object A's collider also registers as object B's collider right? Well the issue is that I have a weapon that is a child object of the player. The issue is that when an enemy's weapon and the player's weapon collide, the player takes damage because their weapon is part of their hitbox. Can I make a parent object not register the collider of its child object, or is there any other solution to this issue? Some workarounds I've tried were to make a separate game object the hitbox of the player and do transform.position=player.position instead if making it a child object, but this has it's own drawbacks.
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
Hey Kiwi! I missed you! :D I hoped that you haven't stopped working on your games, I'm glad you didn't. :) In a collision, you can access the exact colliders that were participating in it, and based on that you can handle the different scenarios. So for example: void OnCollisionEnter(Collision collision) { // This will be the sword's collider for example when the enemy hits your sword // But it will be your body's collider when the enemy hits you Collider myCollider = collision.contacts[0].thisCollider; // And this one is the enemy's sword's collider, this could come in handy Collider myCollider = collision.contacts[0].otherCollider; } But instead of checking the exact participating gameobjects, I would go with checking their tags and decide the damage taking based on that. Like for example, there would be "weapon" and "player" tagged objects with collider on them. Hope this helps! Let me know if not. :D Cheers!
@kiwioverlord9519
@kiwioverlord9519 5 лет назад
@@CouchFerretmakesGames Hey, I've missed you too! It's been awhile since me met, but it feels like just yesterday you had only 400 subs! Now you have 4,000?! Well done and well deserved! And I don't imagine I'll stop programming anytime soon, I've had some success with my game on Itch.io: I reached 250 views :D , and there's no way I could've done it without you. 250 thanks you's! I'm a bit confused about the Collider myCollider = other/this Collider How does the other/this argument work? And I do use the tags "weapon" and "player" to deal damage; the enemy's weapon has a script "Weapon", which runs like this: if col.gameobject.tag = player, col.getcomponent player.HP-=10 but its still an issue because when the enemy weapon collides with the player's weapon, the weapon counts as tag = player since its a child object of the player, and the player takes damage.
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
@@kiwioverlord9519 Hey Kiwi! I've put together an example for you and sent it in an email. However, the code looks like this and is attached to the Player gameobject (the parent): using System.Collections; using System.Collections.Generic; using UnityEngine; public class MyScript : MonoBehaviour { public Collider2D playerCollider; public Collider2D swordCollider; void OnCollisionEnter2D(Collision2D collision) { ContactPoint2D contact = collision.contacts[0]; if (contact.otherCollider == playerCollider && contact.collider.tag == "Weapon") { Debug.Log(gameObject.name + " get hit"); } if (contact.otherCollider == swordCollider && contact.collider.tag == "Weapon") { Debug.Log(gameObject.name + " parried"); } } } And the swords are a simple child object with a collider. Oh and yeah the Players have rigidbody2d components because they are necessary for collisions. :)
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
@@kiwioverlord9519 And thank you for the support :). I really appreciate it, and I'm glad that my work helped you. I'm happy to hear that. :) Don't forget to link your game so I can check it out.
@kiwioverlord9519
@kiwioverlord9519 5 лет назад
@@CouchFerretmakesGames Hi, oh yeah here's the link: kaiway.itch.io/spintowin It's pretty sophisticated if I do say so myself, so take a look at the Controls page. Also, I've got to add you to the Credits section! Is there a way to make Unity redirect to a link, like your RU-vid page? And how do you want to be addressed in Credits? Just "CouchFerret"? And my support is the very, very least I could offer for the absolutely priceless help I've received from you! :)
@kureshimiru
@kureshimiru 4 года назад
Hi, I'm trying a movement solution almost exactly like yours, using Rigidbody2D's velocity property, but my character's movement is extremely jerky this way. My mini-script contains a playerRb (Rigidbody 2D) parameter, a Vector3 movement vector, a function called ProcessInput() that consists of only a single line (movement = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0.0f)), a Move() function also with a single line (playerRb.velocity = new Vector2(movement.x, movement.y) and an Update() function that calls ProcessInput() and then Move(). Has anyone solved this problem? It can't be only me...
@Caslte371
@Caslte371 5 лет назад
Can I see scripts code?
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
I'm working on it to have the scripts available online. Unfortunately, until then they are only visible in my videos. :/ I'm sorry!
@Caslte371
@Caslte371 5 лет назад
@@CouchFerretmakesGames can u load them on cloud or github for now? Ты случайно русский?
@Moreno6000
@Moreno6000 4 года назад
So why does my oncollision event not work it's driving me crazy
@gamerheroine
@gamerheroine 4 года назад
might need to click the 'is trigger' for oncollisionenter function? Or make sure the 2d vs not 3d's match for collision types. Those are my usually things that cause me problems but I'm not expert
@sparklestorm1236
@sparklestorm1236 Год назад
thank you for calling me a game dev. I don't know if I would go as far as to say that, but thanks anyway
@arandomhashbrown3756
@arandomhashbrown3756 5 лет назад
New subscriber
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
Welcome! :)
@RedstoneHair
@RedstoneHair 4 года назад
Why does my character slide????!!!!!!
@keithzhengzhaokhong2782
@keithzhengzhaokhong2782 4 года назад
nvm its a 2d game. Nice
@fisash9737
@fisash9737 4 года назад
а со слоями у тебя всё в порядке а? м?
@sly_darkskullghost_soul5445
@sly_darkskullghost_soul5445 3 года назад
oh god
@vidmangame6241
@vidmangame6241 4 года назад
Kár hogy nem magyar tutorialok vannak a csatornán :(
@Aaaalfaroeo
@Aaaalfaroeo 4 года назад
Great, but now player's hitboxes are in it's feet.
@monolitt7763
@monolitt7763 5 лет назад
Тут была Россия
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
I'm glad to have you here!
@Mr.Epsilion
@Mr.Epsilion 5 лет назад
Как и везде )
@omarkamal3595
@omarkamal3595 2 года назад
Pause.
@monolitt7763
@monolitt7763 5 лет назад
Привет
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
Hello! ^ - ^
@otvetimailrur
@otvetimailrur 4 года назад
Русские отзовись!
@basedbartholomew3968
@basedbartholomew3968 5 лет назад
My Opinion: These 2d Top Down Games Are One of The Best Styles. I don't Know Why So Many People Hate it
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
I agree!! I don't know either. :D
@kodo777
@kodo777 5 лет назад
Dude, you only have 1.5k subs??? The quality of your vids equate to more!
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
It's 1.6k now! :D Thanks man! I think I'm growing in a healthy manner. :)
@tiskolin
@tiskolin 5 лет назад
Why add a rb? Isn't just a collider enough...?
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
Yep, it should be enough to just put an rb on the player and do the walls without one. I think I'll dedicate a whole episode to the collision matrix in Unity and I'll fix this then. Thanks for pointing it out though! :)
@jacktjong1266
@jacktjong1266 5 лет назад
Just wow. I've searched land and sea for a way to create sturdy colliders that do not rely on overlapping to create a solid border and never have I ever found the words "composite collider" anywhere. This changes my entire game plan. Thanks for the tutorial.
@nasym909
@nasym909 5 лет назад
Thanks for everything you helped me a lot can you do more tutorials top down about jumping thanks again
@jeremiemorinderuyter9817
@jeremiemorinderuyter9817 5 лет назад
Lovely character, by the way too avoid making all your variable "public" when want too see them in the inspector you can use the decorator "serializefield" , here the link to the documentation : docs.unity3d.com/ScriptReference/SerializeField.html .
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
Thanks for the suggestion. I should have mentioned it in the video. I'm aware of the SerializeField decorator, but I'm coming from a Python background where there are no access modifiers and you are also allowed to do almost anything. I like this kind of freedom, and I think it's a bit clearer too (but more error-prone too). However, both the SerializeField and public are accepted and commonly used practices. I think I'll mention it in the next programming episode. :) Thanks!
@rickygr97
@rickygr97 3 года назад
i think this is one of the best explanations there is on youtube for explaining colliders thank you
@clapper2564
@clapper2564 3 года назад
You're the best!!!!!
@LordnachCTM
@LordnachCTM 4 года назад
Why is this channel so hidden from the world, damn you YT for not showing me this before
@WoThFal
@WoThFal 5 лет назад
Hey! Thanks for the tutorials! i really enjoyed watching them and learning something :0 i have a question and that is how do you make a character jump in a top down game? I've been looking for it in a lot of places but haven't founded the answer. I dont know if you could make a video or guide me to the materials i need do it.! Thanks!!
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
Hey! :) Well, it depends on what kind of jumping you are talking about. If it's just a simple jump like jumping over a fence, then it isn't that difficult, just a few tweaks with the colliders for a short amount of time to let the character go through the fence. However, I have a feeling that you are thinking about jumps between platforms and such. The thing is that it remains simple as long as the overall world of the game remains flat game mechanics wise. For example in this game the map itself is flat, there are no hills. But if you want to make the character jump between platforms with various heights and fall if he fails to jump long or high enough then a 2D solution like this game have will be tough. I would recommend making your game in 3D isometric perspective but using 2D sprites to still keep the 2D feeling. In 3D you can simulate the correctly the positions and not just fake the third dimension like I did in this game. However, if your platforms and the ground remains flat in your game, and you only have a flat surface with holes in it, then that could be managed in this 2D solution. Hope I make sense! :D Let me know your plans in detail so I can suggest a solution for it. Like reference existing games, or describe the limits of the system, so we can decide that a 2D solution works for you or it would be wiser to switch to a 3D but 2D looking game. :) Cheers!
@WoThFal
@WoThFal 5 лет назад
@@CouchFerretmakesGames Thanks for your response! Looks like im going to make it flat then! haha, You caught me, i was thinking in simulating that kind of 3D. Mostly for pits or cliffs so the player can jump them down, (just like in Hyper light drifter or in CrossCode) However i dont think im going to add it, but the curiosity got me to ask you. Thanks again for your time to answer me. it really helped me a lot!
@Ziplock9000
@Ziplock9000 Год назад
You know you can click the 'Edit Collider' and visually change the position and size rather than guessing and putting values in Offset and Size
@DebugFrog
@DebugFrog 4 года назад
Hello, your tutorials are fantastic!! I've been working on a top down 2D game and I was wondering if you'd be able to answer a question? :) I've followed yours and many other's tutorials for getting solid collisions with walls working, but no matter what I do, my character slides right through the colliders. I have rigidbody and colliders set up with is trigger unchecked, my character has a rigidbody and a collider, i've even checked that the player isn't moving too fast for the collider to detect - everything seems like it should be working, but it just isn't. Thanks so much for your videos!!
@linguinelabs
@linguinelabs 4 года назад
Did you find a solution?
@mayankkela8485
@mayankkela8485 5 лет назад
Thanks you solved it my typical problem
@blenderinc.4402
@blenderinc.4402 Месяц назад
rigid boy is worse in performance than if u write the 10 lines of code by yourself
@glassystudio
@glassystudio 4 года назад
Arnold Schwarzenegger teaching game development
@Exorion1er
@Exorion1er Год назад
Why does your Grid object need a Rigidbody2D ? Colliders can be standalone
@TheHobbit28
@TheHobbit28 5 лет назад
Great Vid! Like your style of presentation a lot
@wowvain2989
@wowvain2989 4 года назад
Hey man! I have a question that apperantly no one else answered on forums and such. When I collide with a wall from the front, everything works fine and my characters shows above the wall, like it should, but when i collide with a wall from behind, my character still shows over the wall because its sorting layer is above the wall. How do I fix this? Is there a script or a setting i've overseen?
@samu3lp88
@samu3lp88 4 года назад
make player and walls layer = position.y
@ethanchien2511
@ethanchien2511 5 лет назад
Love your channel! So helpful for beginners like us! Thank you so much for uploading!
@Eragarev
@Eragarev Год назад
I never knew about the composite collider thing.
@nivmiz0
@nivmiz0 3 года назад
THANK YOU SO MUCH! The phantom vertices were annoying me in my game, so I watched this and it's completely fixed now!
@Bignose_Dev
@Bignose_Dev 3 года назад
my damt player didint making collide i no idea i have all compoments !
@ano7371
@ano7371 3 года назад
At 5:53 how to implement that in game side-scrolling
@Mythorian
@Mythorian 5 лет назад
How to make it so the animation stops when walking into a collision?
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
That's a tough one, but pretty cool idea. I'll think about it to have it in the game. Thanks! We could achieve that with collision detection functions like OnCollisionEnter2D, and with a new animation parameter. However, I think the main struggles with this would be to find out that the character actually running into the walls or just running near the walls.
@milanstevic8424
@milanstevic8424 5 лет назад
@@CouchFerretmakesGames (didn't watch the video yet but) the animation should stop only when the character velocity stops. if the character sprite stops due to hitting a collider (velocity = 0), its animation should also stop (animation = 0). if it doesn't stop (velocity > 0), the character is either sliding along the edge of the collider or not hitting the collider at all, so the animation shouldn't stop as well (animation > 0). the result will look natural, and the game will play as expected, with no major changes (not even OnCollision events are needed). you already have the case where velocity = 0 and animation > 0, which is basically the idle animation. (if you don't have it already, it's well supported anyway), and the only case where you want the case of velocity > 0 and animation = 0 is if you want to have a character fly off due to damage (maybe bounce in the air slightly like a ragdoll) or some other physical force that might act on him (you know, like spring traps etc). in that case the walking animation might appear uncanny, simply because his legs are detached from the ground, and in general, this is how you convey the notion of an involuntary movement in such games (if no other animation is dedicated to this context).
@Alex_ADEdge
@Alex_ADEdge 3 года назад
Great tutorial, cleared up a couple of nagging questions I had about composite colliders. Took the collider count in game down from 1000+ to 10, so quite the improvement as you could expect! XD
@irishbruse
@irishbruse 5 лет назад
you shouldnt be putting a rigidbody on the wall its bad for performance only one rb is required for a collision.
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
That's true, thanks for pointing it out! I should have covered static colliders (without rigidbodies) in this episode. I'll try to talk about it in the future. Although at the end of the video I have only 2 rigidbodies, 1 for the player, and 1 for all of the walls (on the Grid). Sadly, CompositeCollider2D requires a RigidBody2d. :/ But, and extra rigidbody or even a couple of extra rigidbodies won't have a huge difference in performance. Usually I try to keep things simple, but want to cover more advanced stuff in the future too. The Collision action matrix would be awesome to cover with all of its 6 different kinds of gameobject setups. Thanks again for the critic! :)
@irishbruse
@irishbruse 5 лет назад
@@CouchFerretmakesGames no prob im enjoying your vids tho they are really well put together. :)
@CouchFerretmakesGames
@CouchFerretmakesGames 5 лет назад
@@irishbruse Thanks! I'm still seeking ways to improve it.
@toaster-chan7386
@toaster-chan7386 3 года назад
Hey so like, I might need some help. So with my top-down game, I can't seem to get the walls working right, how do I get it to look like my character is going behind the wall? When the player walks in front of it, the layers work fine, but I can't get him to walk behind it without still appearing on top.
@heytheremogwai
@heytheremogwai 4 года назад
I have a sprite with a box collider, and I have a tree with a poly collider. Collision is detected, but my character sprite also pushes the tree around. How do I make it so that the tree doesn't get pushed around?
@RELOADEDhub
@RELOADEDhub 4 года назад
thanks its really helpful for me in my project ..
@betrayedpickle291
@betrayedpickle291 2 года назад
thanks, this was SUPER useful
@paulalexandercruzesteves576
@paulalexandercruzesteves576 3 года назад
Good video is just what I was looking for , thanks :D
@tiger_serzh
@tiger_serzh 3 года назад
Hello from Russia! And thanks for your lessons!
Далее
КАК БОМЖУ ЗАРАБОТАТЬ НА ТАЧКУ
1:36:32
6 Years of Learning Game Development
17:20
Просмотров 137 тыс.
Creating SMART enemies from scratch! | Devlog
5:40
Просмотров 330 тыс.
Coding Adventure: Portals
16:06
Просмотров 1,3 млн
Optimizing my Game so it Runs on a Potato
19:02
Просмотров 591 тыс.
How to make AWESOME Scene Transitions in Unity!
19:45
Просмотров 944 тыс.
Can You Beat Hitman 3 Without Breaking ANY Laws?
22:37
Technique for Creating Beautiful Level Design
11:48
Просмотров 870 тыс.
What size should your assets be? | HD 2D GAME ART
12:10
TOP DOWN MOVEMENT in Unity!
22:30
Просмотров 1,2 млн