Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
0
Question by Cricket88 · Jan 01, 2014 at 04:51 PM · 2dcollisioncollidersphysics2d

Colliders 2d apparently touch each other even if they should not.

Hi everyone, i'd like to ask you about a problem i ran into, relating to colliders. The title is explanatory... reminder: we're talking about physics and collider 2D (the new tools).

The attached image shows in the bottom part, the Player colliders (typical sphere for the feet and rectangle for the body) and a Ground on the left. The Ground has two colliders: one of the Ground shape (with some material and friction) and a outer one just on the edge ( small rectangle with no friction). This is done for preventing the player to stuck on the ground side if some force is applied (during movement while falling for example).

If you look at the bottom part of the image, you may notice that the player collider got stuck...bringing the character to the edge and letting him fall MAY after some attempts results in this scenario. You can't still notice, but the sphere, if you zoom in, isn't really touching anything.

In fact looking at the image above, I've removed at runtime the sphere collider and discover that the collider causing the block is the rectangular one. As you may notice it's not touching anything, nor any input is given at this point. I use a simple script (inspired by the last unity 2d lesson) for player control, and collision detection. Anyway this should be irrelevant.

So summing up:

1) Seems that an external collider (the circle) does not cover the inner one (the rectangular) as intuitively expected. It seems that the rectangular collider got stucked by himself.

2) Also...the colliders aren't touching, but the player's one is still on the air. Is this a gui problem?

Any help would be really appreciated... Thank you in advance :)

alt text

untitled-1.jpg (208.4 kB)
Comment
Add comment · Show 5
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 ceejjay · Jan 05, 2014 at 09:45 PM 0
Share

I've been running into this same issue myself. Specifically the top image. I haven't had a chance to do much troubleshooting, but it's definitely been causing issues in new platformer project.

$$anonymous$$y character will stand next to a wall, jump straight up, and stay on top of the corner exactly as illustrated in the first image.

avatar image Cricket88 · Jan 06, 2014 at 12:14 PM 0
Share

I'm trying to verify if the colliders really are touching. So I did some calculation and checked their position, the transform position on x axis of ground (expecially the external collider) and pg, being sure it would be the absolute one for both (no nested objects). I apply the scale the character has, 0.2, to the radius of the circle and rectangle colliders. Ultimately...I hope to have made no mistakes...if this would be true...pg and ground colliders aren't touching on x axis (nor circle nor rectangle ones). Ther's a short haul between them...as expected (about 0.0277432 in the instance I checked).

I'm quite in a whirl O_o...

$$anonymous$$ay this be a scale problem?

avatar image Invertex · Jan 06, 2014 at 12:38 PM 0
Share

This seems to be happening even with box colliders too. I can't just use prefabs squares each with their own collider, or else my player will often get stuck at the edges, even if the colliders overlap eachother. Have to manually lay out one long collider wherever needed =/

avatar image Cricket88 · Jan 06, 2014 at 01:32 PM 0
Share

In fact this is a box colliders issue :( I think it's just about colliders in general, but that rectangular ones bring this problem march, stand up and be counted more easily...

avatar image Cricket88 · Jan 07, 2014 at 11:46 AM 0
Share

I bumped into a thread that a friend pointed out to me...it mades me thinking about one simple question...

how unity manages its colliders? how it detects if 2 colliders are nearby and/or touching? (let's restrict to the 2d ones)

In fact ther's a $$anonymous$$imum distance between colliders which will be inevitably left free. I'm led to believe that overlapping of edges may result in loss of detection varying on which technique is used. If a native colliders raycast method is used, the scenario may get more difficult to comprehend. Let's not forget also that the stuck is a consequence of the fixed angle option...otherwise the object would have rotate, pivoting on the edge, and fall away.

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Invertex · Jan 18, 2014 at 10:38 AM

Well, I found out the answer to this. The issue is that while the first collider you're on decides that you should be pushed out of it upwards, the collider you start going over next sees that you're more on side of it then the top and decides the shortest path to push you out of the collider is backwards, so you get stopped. The solution seems to be to use Edge colliders to build your surface instead. Make your cube out of them and it seems to work perfectly! (plus you can then define the sides as the Wall layer and the top as the Ground, simplifying level design even more.

MelvMay pointed it out in this thread:

http://forum.unity3d.com/threads/223054-BoxCollider2D-colliding-with-EdgeCollider2D?p=1488478&viewfull=1#post1488478

Including a useful link about the issue.

https://www.iforce2d.net/b2dtut/ghost-vertices

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 Cricket88 · Jan 20, 2014 at 12:52 AM 1
Share

Seems like you hit it on the nail :)

Intuitively i would expect to see the object pushed up and left from the scenario you've described. But probably this is due from a slightly different situation:

one force (left) is applied to circle collider, and the other (up) to the rectangular one. The result is trying to separate two collider which cannot in fact be separated...

the other option would be: two pushes in different axis on a same collider simply result in a stuck.

Sure as hell is that the object keeps on being stuck even after removing the touching collider...and that's weird XD

Thank you very much :) :)

avatar image
0

Answer by gianluca8824 · Jan 14, 2014 at 10:05 PM

Take a look at Physics Manager on Project Settings: in particular try to ajust Min Penetration For Penalty and Solver Iteration Count

http://docs.unity3d.com/Documentation/Components/class-PhysicsManager.html

Let me know!

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 Invertex · Jan 15, 2014 at 02:47 AM 0
Share

Tried it, unfortunately doesn't work. That Physics panel is only for 3D colliders, not the new 2D colliders. The new Physics2D settings only come with 2 options which are Velocity and Position Iteration count, and don't seem to affect the issue at all really.

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

21 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

Related Questions

Multiple Stacked Colliders only register for single object 0 Answers

Player attack doesn't recgonize different colliders (unity 2D) 1 Answer

2D Collider aren't exact? 6 Answers

Have projectile destroy some objects on collision but normally interact with others according to its properties. 1 Answer

Colliders in a wall jut out 0 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