Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Lexadrik · May 03, 2020 at 05:39 PM · rigidbody2dcollision detectioncollider2d

How to stop Rigidbody2D from getting stuck on corners?

I have a tiny 2D game (scaled to 16 pixels-per-unit) with a character that must be able to walk up slopes. I gave it a CapsuleCollider2D and it seems to work fine. Additionally, my level is made up of several blocks that group into a parent with a CompositeCollider2D, as shown in pic below: composite collider picture

However, when jumping from one platform to the other, falling on the corner gets the character stuck as shown in this capture. I can walk off the platform to the right, but I can't walk onto it to the left or even jump (which I assume just means my ground checking method is always returning false while stuck).

I've searched online for the solution but most people seem to fix it by changing their previously BoxCollider2D into a CapsuleCollider2D but I'm already using that. Is this a consequence of the scale of the game being too small, of using GameObjects as platforms instead of Tilemaps, of me having the wrong Rigidbody2D settings, or perhaps something else entirely?

compositecollider.png (10.0 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Sspyrshlsx · Aug 03, 2020 at 07:51 PM

This is a common problem with tile based games. You will notice this way clearly if you use a full tile based collider system (like 1 box collider for each tile). This has a pretty simple fix however.


1) Change the player's collider to 4 edge colliders to form a box collider. This should fix it.

2) Change the tiles' colliders to 4 edge colliders to form box colliders. This should also fix your issue.

Both solutions work, however you might want to use different solutions for different games. Do keep in mind though, that different edge colliders do not collide with each other.


Regards.




Edit: I was just trying to polish my character movement. I tried adding a box collider with some edge radius, this fixed the issue plus gave a better result - the edge radius made corner movement smoother.

Screen shots: alt text alt text my drawing skills are perfect, don't you think so


edgeradius.png (3.1 kB)
edgrds2.png (27.8 kB)
Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image EvanCheddar · Feb 21, 2021 at 09:38 PM 0
Share

Hey just want to say thank you for this information. For some reason I was looking for a solution to this a few months ago and found info on composite colliders and have been using that but it's not a perfect fix. This is so simple and works well.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

135 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Is it possible to have continuous collision detection with dynamic points on Edge Colliders? 0 Answers

dragging on a gameObject messes with collisions 1 Answer

multiple objects on oncollissionstay2d 1 Answer

Player not taking damage on collision with enemy 1 Answer

Enemy bullets pass through my walls 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges