Search Unity

Colliders randomly stops working

Discussion in 'Physics' started by Hertzole, May 22, 2016.

  1. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    Ironic that youre using the CC... you aint got nothing on me kid
     
  2. aliceingameland

    aliceingameland

    Administrator

    Joined:
    Apr 18, 2016
    Posts:
    142
    *ahem*

    Thanks to those trying to keep this thread on topic and productive. I don't want to see any further antagonistic behavior in here from anyone.
     
    ModLunar and Harinezumi like this.
  3. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
  4. DavidByers

    DavidByers

    Joined:
    Dec 31, 2010
    Posts:
    79
    I just wanted to chime in that I'm running into the same issue. Unity will randomly ignore collisions with a character controller and mesh collider, it feels like it happens every 1000 colliders or so. Collisions will not work at all with a collider that is gliched. I'm running 5.3.5f1 on Windows 10.
     
  5. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    If you want it fixed in a timely fashion, you're going to have to write your own.
     
  6. OneManArmy3D

    OneManArmy3D

    Joined:
    Jun 2, 2011
    Posts:
    191
    unity 5.3.6f1

     
    Harinezumi likes this.
  7. Peris

    Peris

    Joined:
    Aug 8, 2012
    Posts:
    5
    Hey guys, I recorded a video of it happening in my game.
    In this case, one of the wall tiles lost it's collision with the player. The collision still works with everything else, including other character controllers. As you can see in the video, I can run straight through one of the wall tiles:

    http://www.brameulaers.net/debugvid/colliderbug_broken.mp4

    The other wall tiles still have collision. Since they are all instances of the same prefab, there's no reason one of them shouldn't be working. It's definitely an engine side bug.

    After refreshing the scene, the collider works fine, as you can see in this video:

    http://www.brameulaers.net/debugvid/colliderbug_normal.mp4

    It's completely random and impossible to reproduce for me :(. Again, it only started happening in unity 5 for me. I've been working on this project since unity 3 and never had any problem before!
     
    eses likes this.
  8. Peris

    Peris

    Joined:
    Aug 8, 2012
    Posts:
    5
    thank you so much! I'll make sure other people I know suffering from this will help upvote it.

    direct link to the issue tracker: https://issuetracker.unity3d.com/is...ently-ignore-collisions-with-random-colliders
     
  9. DavidByers

    DavidByers

    Joined:
    Dec 31, 2010
    Posts:
    79
    Any news on this???

    This is a major bug, and quite frankly it is completely unacceptable that this is happening in a non beta release. Especially considering this has apparently been happening for months.

    Here's a video of it happening to me, this time in Unity 5.4

     
    Last edited: Feb 5, 2017
  10. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    You still have the option of writing your own so you have full control rather than being at the discretion of the Unity Devs.

    Seems this task is too hard to even consider, even by 'experienced scripters'
     
  11. atmosgames

    atmosgames

    Joined:
    Dec 14, 2011
    Posts:
    71
    Anyone found a fix for this yet?

    Really struggling with this one. It breaks my game. Here's a video of it happening:

     
    Daniel-Strayer likes this.
  12. Daniel-Strayer

    Daniel-Strayer

    Joined:
    Apr 16, 2013
    Posts:
    68
    This is still happening as of Unity 5.4.2f2.
    I had it happen to me the other day with a UFPS controlled CharacterController falling through a box collider. The box collider continues to lack collision detection throughout the current play session, but when restarted, it goes back to normal. In our experience, it is an apparently random collider, and the problem is not at all consistent. We believe that the underlying scene physics management may be excluding a single collider. Possibly something similar to a collection being iterated and excluding a single index due to a mistake in the iteration range. This may be a Unity bug, or possibly a Physx bug.
     
    Last edited: Dec 10, 2016
    atmosgames likes this.
  13. Daniel-Strayer

    Daniel-Strayer

    Joined:
    Apr 16, 2013
    Posts:
    68
  14. Peris

    Peris

    Joined:
    Aug 8, 2012
    Posts:
    5
    Yeah I agree, it's possibly something like this. It seems to always be just a single collider in my scene.
     
  15. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    229
    Any update on this?
     
  16. murkantilism

    murkantilism

    Joined:
    Apr 30, 2012
    Posts:
    21
    The only update I could find is that someone posted a video to issue 809914 showing a reproduction in 5.5.

    I'm still investigating to confirm if our problem is in fact a reproduction of this issue, but I believe that my partner is seeing it in-editor on his OSX machine (which is quite curious because the issue ticket says "not reproducible on OSX").The symptoms match very closely to the problems described in this thread.

    We're at 5.5.3 using default CC on a Continuous rigidbody, with custom written movement physics (omnidirectional autorunner).

    Although unconfirmed it's possible that setting our player's RB to Continuous Dynamic may resolve this issue (suggested here). It's also possible that this issue was only exposed when we recently (2ish weeks ago) set a ton of our non-moving gameObjects to Static (also touched on in previous link).

    We have yet to see the issue on iOS, Android, Windows 10, Windows 10 Editor, or OSX. Only seen on OSX Editor thus far.
     
  17. Struts

    Struts

    Joined:
    Jan 12, 2017
    Posts:
    9
    Hello, im very new to unity but i had a similar issue. It was caused by the speed of the moving object, it passed through the collider faster than the fixedupdate timestep. Maby lowering the speed will help!
    Good luck!

    Edit: After reading additional comments its apparent that this is another issue. However i will leave the comment in case it helps someone else.
     
    Last edited: Jan 12, 2017
  18. atmosgames

    atmosgames

    Joined:
    Dec 14, 2011
    Posts:
    71
    Finally got some info from Unity on this:

    "I was successful in reproducing your bug and got some details about it from the developers.

    This is an issue that people tend to run into when using the Character Controller that ships with Unity. Unfortunately, this character controller was written by the folks over at PhysX as an example, and only became a feature addition because it was so widely used. It uses very patchy code that is hard to debug.

    Fortunately, in light of all the complaints received about the CC, we have decided to expose a PhysX method that will go leaps and bounds in aiding users to write their own character controller. It’s the Physics.ComputePenetration method and it will be available from Unity 5.6 going forward. If you’d like to check it out, 5.6 is in Beta right now.
     
  19. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    229
    Are there any character controllers in the asset store that are as simple and functional if we are going to go replacing?
     
  20. freeman08

    freeman08

    Joined:
    Sep 3, 2012
    Posts:
    11
    I'd be interested as well, are there any simple and functional character controllers available on the asset store?
    I'm currently using the Unity default CC for my First Person Game and experience the same issues, although very rarely. Unfortunately I lack the skills to write my own.
     
  21. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    596
    Hey everyone on the thread,

    I wanted to let you know that we have worked out a fix for this case finally. It's going to be available to the subscribers of 2017.2 alpha builds in a matter of weeks. We'll be providing back-ports for earlier versions too, once the fix has been given a go in the latest version.

    Anthony
    R&D Physics
     
  22. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    422
    Very awesome to hear! Then I don't have to be so scared of using it in the future! :D
     
  23. banyango

    banyango

    Joined:
    Mar 31, 2014
    Posts:
    19
    That's great to hear Yant!
    Is there anyway to get an eta on the fix in 5.5.3? I'm nearing my shipping date, if I could get a fix for this that'd be great!
     
  24. SomeGuy22

    SomeGuy22

    Joined:
    Jun 3, 2011
    Posts:
    722
    I've noticed this issue myself for the like the past several years... I always thought I was just hitting the limit of how many colliders my system could handle. I've had to scale back some things in the past to stay under the "limit". Strange to see that there is actually some sort of solution for it... But this has piqued my interest... Is there actually a limit where the Physics system just stops recognizing collisions? Or will it just bog down the FixedUpdate to try to remain accurate?
     
  25. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    229
    This is great thank you. Will it be in 5.6.1? or 5.6.2 I'm guessing.
     
  26. 500_pts

    500_pts

    Joined:
    Sep 29, 2014
    Posts:
    3
    Any updates on this? Or at least a post in the issue tracker? Just curious about ETA of backports. Thanks :)
     
  27. rstorm000

    rstorm000

    Joined:
    Aug 19, 2010
    Posts:
    229
    Also interested, as usual
     
  28. banyango

    banyango

    Joined:
    Mar 31, 2014
    Posts:
    19
    Any updates on this?
     
  29. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    596
    ModLunar likes this.
  30. Scarletor

    Scarletor

    Joined:
    Sep 24, 2016
    Posts:
    6
    its about 4 years and this bug still occur....
    why ?
     
    DutchEnterprises likes this.
  31. OneManArmy3D

    OneManArmy3D

    Joined:
    Jun 2, 2011
    Posts:
    191
    I am pretty sure that bug is fixed. At least in unity 2018 everything is fine.
    What version of unity you are using?
     
  32. ChazBarros

    ChazBarros

    Joined:
    Oct 25, 2016
    Posts:
    4
    It's still happening in Unity 2018.4.0f1. It's not that common anymore, but some of our players reported this issue and we were able to reproduce. Unfortunately, it's pretty random so it's hard to submit a test case.
    The best fix that we found is to write your own character controller. There are also several really good character controllers in the asset store.
    Anyway, would be great to have the character controller fixed. Many developers use this component since it's shipped with Unity.
     
  33. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    596
    Honestly, authoring a game-specific character controller isn't that bad of a thing, as it gives flexibility alongside deep understanding of how things work under the hood. That's what I used to do in my gamedev years too. Now, it's clear a fix for the issue you described would massively help, and I'll check options with our QAs -- maybe some similar reports could be found in our bug database. As I have your attention -- please feel free to submit a repro if you have it at some point in future, much appreciated. Thanks! anthony
     
    ChazBarros likes this.
  34. goel_sam123

    goel_sam123

    Joined:
    Jan 18, 2017
    Posts:
    2
    I am building a 2D game in unity engine 2019. I have a box collider 2d attached to my player which also has a rigid body attached to it . I have a ground layer setup which too has a box collider 2d attached. The collisions between the player and the ground are inconsistent. Sometimes the player collides with the ground ,sometimes it doesn't . Even at low velocities the player escapes the collider and collision doesn't occur. The collider is fairly narrow (of negligible width) but I don't think that might be the reason behind this. Please Help?
     
  35. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,459
    This isn’t related to this thread so I would ask that in the future you create a new one and not hijack an existing one. Anyway, what you describe just sounds like collision tunnelling which can be an artifact of too high a speed and/or too small a collider when using discrete collision detection on a rigidbody. You can use larger colliders, slower speeds or use the slower continuous collision detection on the rigidbody. Tunnelling can also be caused by you incorrectly moving the rigidbody via a transform.

    If you continue to have problems after looking at the above info then please post a new thread, thanks.
     
    gilbertoPlayX and yant like this.
  36. fovapps

    fovapps

    Joined:
    Jul 15, 2019
    Posts:
    2
    I'm still getting this bug with Unity 2019.1.10f1 !
    Character controller suddenly ignore random box collider for no reason during gameplay. The frequency of this phenomenon is also completely random, which makes it difficult to reproduce. Nevertheless, this is definitely still happens, and not so rarely.
     
  37. Haze-Games

    Haze-Games

    Joined:
    Mar 1, 2015
    Posts:
    189
    Hi all,

    I know this is old but I'm still have this issue as well in 2020.1b11. However, I can note that:
    - In my project, it happens 10x more often in builds than in editor
    - It seems like it happens only for static colliders, and with static batching enabled (doubt it would have an impact though)
    - Disabling "Prebake Collision Meshes" in Player Settings seem to greatly reduce the chances of this bug happening

    I wonder if this bug has been re-introduced or if it was partially fixed?

    Thanks
     
    OneManArmy3D likes this.
  38. fuczak3

    fuczak3

    Joined:
    Mar 28, 2020
    Posts:
    1
    Hi!
    I just upgraded project from 2019.3.11f1 to 2020.1.0f1. Colliders stopped working immediately. I have two objects with colliders like this:
    upload_2020-8-2_21-40-59.png

    upload_2020-8-2_21-42-29.png

    not sure if the setup is correct, but it worked before.
     
  39. OneManArmy3D

    OneManArmy3D

    Joined:
    Jun 2, 2011
    Posts:
    191
    This problem is back again... In unity 2018.1 everything was fine.
    After switching to unity 2019 LTS players again report this problem.
     
  40. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    596
    Hi @OneManArmy3D! Do you have a quick repro for this issue that would illustrate the regression? Just to make sure it's this exact problem being back, and not something else instead. Thank you so much for participating.
     
  41. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    596
    Update: it looks what was causing this problem originally is indeed back with the PhysX 4 upgrade, because the old PhysX 2.8-style collision groups functionality has been moved and refactored a little, and our original patch didn't automatically apply. Here is the offending bit for the curious minds: https://github.com/NVIDIAGameWorks/...c5/physx/source/physx/src/NpQueryShared.h#L41

    Can someone open up a fogbugz case for the tracking purposes please?
     
    Haze-Games likes this.
  42. Haze-Games

    Haze-Games

    Joined:
    Mar 1, 2015
    Posts:
    189
    @yant My god, if you manage to successfully locate the bug, and fix it, trust me, you'll be saving my life (and those of many others!).

    I've been struggling with this bug for years, I don't think it was ever fixed for me. That would make me extremely happy :)
    I can try and create a fogbugz case just by reporting from Unity, right? I'll link to this post.

    However, I don't have a successful easy repro project unfortunately. Is that an issue? As mentioned in the original post, it's extremely hard to reproduce thanks to the extreme randomness of the bug :(

    Thanks for looking into this!
    Charles
     
  43. Haze-Games

    Haze-Games

    Joined:
    Mar 1, 2015
    Posts:
    189
    I posted a bug report for this, for tracking purposes: http://fogbugz.unity3d.com/default.asp?1279841_o5ejbfl3fvurto94

    Thank you!
     
  44. bolagadalla777

    bolagadalla777

    Joined:
    Mar 13, 2020
    Posts:
    1
    I found adding Composite Collider 2D to the any 2D collider checking Using Composite helps. But only for 2D tho.
     
  45. barge9

    barge9

    Joined:
    May 13, 2015
    Posts:
    12
    Wow what a thread! the bug or known issue is occurring with me here for editor v. 2019.4.... Glad I came across this thread because I was at a standstill...
     
  46. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    596
    Hey guys!

    Just wanted to add a few more technical notes regarding this case that has now been reported fixed (again) in 2021.2.0a10.

    So the core of the problem is that though it seems clear why the issue returned back with another PhysX upgrade, and what bit exactly is responsible for triggering it, we couldn't actually build a project to verify the fix. No other projects that worked priorly, and were good repros of the original fix back in 5.x day, work today.

    That said, I pretty much applied the logic & flow of the original Unity 5.x fix to the modern Unity 2021.2 codebase, and do hope the issue is gone, however we can't guarantee & verify -- need your help. It's perfectly understandable that some repros require publishing builds to plays (not a good idea doing that with an alpha version), but in order to back-port the fix I'd need to know if it actually addresses the problem for sure or not. This is where your help is needed, hope some solution could be worked out here.

    As to the nature of the problem, it will only trigger with ChracterController really. You need a lot of other Colliders in the scene. Basically, there is some old code in PhysX that comes from PhysX 2.8 days with rudimentary collision masks feature that would ignore collisions of two objects if their masks being AND'ed gave out zero. However, in Unity, we use those fields of filter to store pointers to the Unity Components corresponding to this PhysX shape. So, if it happened so that a CharacterController overlapped something else, and their native pointers to the Unity Components being AND'ed gave 0 -- the collision is going to be skipped. See this: https://github.com/NVIDIAGameWorks/...c5/physx/source/physx/src/NpQueryShared.h#L48

    Like been said before, this problem is exclusively with CharacterController, nothing else was affected by the collision mask mechanism.

    Hope this perspective helps.

    Anthony
     
    Haze-Games likes this.
  47. Haze-Games

    Haze-Games

    Joined:
    Mar 1, 2015
    Posts:
    189
    Thank you so much @yant, it's excellent to know it might be fixed, and to have more perspective. Now, I'm going to try and create a repro project, as you said, it's very hard.

    I'll create maybe some automatic play mode test in a separate project to run the build over and over, maybe at higher timescales.

    A few questions if you have time, might help increasing chances of reproducing this:
    - Do you think MeshColliders have more chances of it happening than simple Box Colliders?
    - I'm pretty sure I've had the issue on simple Box Colliders but we also have Mesh Colliders in the scene, so maybe a combination of both increases the chances (transitioning from/to a Mesh Collider while currently colliding with a Box Collider, for ex)?
    - What kind of situation could increase the chances of it happening - i.e. in your opinion, what could potentially increase chances of "CharacterController overlapped something else, and their native pointers to the Unity Components being AND'ed gave 0" happening?
    - Would using complex Physics Layers increase these chances too? By complex, I mean disabling some collision layers in collision matrix. For ex, having collisions enabled for all layers or only some, could potentially increase chances of this bug happening?
    - Could enabling / disabling colliders or GameObjects at runtime increase the chances of this happening?
    - Can Static or Dynamic batching increase chances of it from happening? We have static and dynamic batching in use, so repro project will use both.
    - Does the presence of a kinematic rigidbody attached to the collider increase the chances? We've had that bug on regular, static colliders, but I don't know if there's a link.

    I'll work on the test repro project based on your feedback above, to try and increase the chances.

    If I manage to reproduce this, I'll then upgrade the project to the alpha version and see if it ever happens. Will let you know!

    Thanks again,
    Charles
     
    Last edited: Mar 18, 2021
  48. Haze-Games

    Haze-Games

    Joined:
    Mar 1, 2015
    Posts:
    189
    I have a simple test project, now running 6 instances of a build in 2020.2.7f1 with tens of thousands of box colliders and a Character Controller moving around.

    We'll see if it ever happens (might take a while). If it doesn't I might try adding in some MeshColliders.

    Will keep you posted, and will update the build if you mention some things that might increase chances of it happening.

    Thanks,
    Charles
     
  49. arfish

    arfish

    Joined:
    Jan 28, 2017
    Posts:
    782
    Have this issue now in some situations of parenting, and then unparenting of objects with colliders, and at the same time removing, or adding an rigidbody.

    Before parenting, the collisions works. Then the players rigidbody is destroyed, and the player transform is parented with the object. On unparenting, the rigidbody is added back. At some distinct situations, it fails, and the player stops collide with the previous parent. It still collides with everything else.

    The player even fails to collide if I manually creates a new box inside the previous parent. But when the box is moved outside the parent the player starts hitting it. haha.

    Think it's a timing problem in how the unparenting/rigidbody things is done. This is in Unity 2018.4.32.
     
    Haze-Games likes this.
  50. Haze-Games

    Haze-Games

    Joined:
    Mar 1, 2015
    Posts:
    189
    Mmmh interesting, I might add randomly changing parenting in my test project, because as of right now, nothing problematic is happening when I'm not ever reparenting nor disabling components at runtime.

    Cheers,
    Charles
     
    Last edited: Mar 18, 2021