Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

5.6.0b10 Late physics collision problem

Discussion in '5.6 Beta' started by LaneMax, Mar 6, 2017.

  1. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    182
    I'm getting some very weird physics collision related problems moving from 5.6.0b9 to 5.6.0b10. It seems that I'm getting late response times for oncollisionenter/oncollisionstay, to where high velocity objects register slower or sometimes don't even register for the On events, whether there convex or not. Any thoughts? I could also post a video if that helps
     
  2. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    337
    This sounds like a similar regression reported in 5.5, it probably related to the PhysX upgrade we did in 5.5. However, not sure what might have affected this going from b9 to b10 in 5.6. Can you pull together a repro project? Will notice this thread to our physics QA. Thanks!
     
  3. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    182
    Thanks for the quick reply yant, also I have some good news, I can reproduce it pretty easily =) It seems that, for whatever reason, when ever you disable the physics GameObject and re-enable it, it will consistently pass through any given collider, I started noticing it because I'm pooling most of my physics objects. I'm attaching a unitypackage with a test scene where you can see an example, seems to work fine in 5.6.0b9, but anything higher b10/b11 seems problematic, also attached a screenshot. Hope this points out the problem.

    Cheers!

    screen.png
     

    Attached Files:

    Last edited: Mar 9, 2017
  4. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    337
  5. CookieSalad

    CookieSalad

    Unity Technologies

    Joined:
    Dec 29, 2014
    Posts:
    10
    Hey @LaneMax!

    We've logged a bug for you and you may track its status in the Issue Tracker by following this link. The link should become active in a few hours, but hopefully sooner.

    Thanks again!
     
  6. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    182
    Awesome! Thanks yant and CookieSalad!
     
  7. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    337
    Hey @LaneMax!

    Appears that the problem is that CCD (continuous collision detection) setting is broken in b10 for objects that get enabled after CCD was set while they were disabled (regression). Will be fixing this ASAP, it's a bad problem. Not sure there are any decent workarounds really, besides this one: set the collision detection mode to Discreet in the inspector and add a few lines to Start / OnEnable to patch up the CCD mode when the bullet gets enabled, like this:

    Code (CSharp):
    1.     // Use this for initialization
    2.     void Start()
    3.     {
    4.         rigid = this.GetComponent<Rigidbody>();
    5.  
    6.         // patch up the broken CCD on enabled objects
    7.         // there is another bug that was fixed in a later version that didn't allow to change CCD modes when Discreet wasn't set in inspector
    8.         // because of that, all bullets need to be set to Discreet first
    9.         rigid.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
    10.     }
    11.  
    Hope this helps - Anthony.
     
  8. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    182
    Awesome great to hear, thanks again!
     
  9. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    337
    Hi @LaneMax, just wanted to let you know that the fix for this issue will be available as part of 5.6f2 onwards. Thanks for the heads up!
     
  10. LaneMax

    LaneMax

    Joined:
    Aug 12, 2013
    Posts:
    182
    Sweetness! Thank you so much