Search Unity

"kinematic bodies with CCD enabled are not supported!"

Discussion in 'Physics' started by dgoyette, Dec 15, 2018.

  1. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,195
    Did this really need to be treated as an error, rather than a warning? Maybe there's some really good reason to avoid this case, but per the error message it seems that PhysX is just going to fallback and use Discrete collisions in this case. So, it feels more like a warning than an error.

    After updating to 2018.3, I'm getting this a lot because of causes where I temporary set a Rigidbody to isKinematic = true. Now it seems that if I ever want to toggle isKinematic, I'll also need to change the collision detection mode, and remember what it was before I changed it. This seems like an unnecessary hassle if PhysX is just going to not really care anyway.

    Anyway, is it possible for Unity to treat this as a warning instead of an error? Maybe that doesn't seem to matter, but with this treated as an error it causes unit tests to fail if this condition occurs.
     
    KevinCastejon, jashan, Split3 and 2 others like this.
  2. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,508
    I don't think it should even be a warning. If the kinematic rb still works as expected then this situation should be simply ignored. The manual should just state that CCD does nothing in kinematic rigidbodies. There are also other situations where CCD doesn't have effect.
     
    KevinCastejon and SparrowGS like this.
  3. garrettstamand

    garrettstamand

    Joined:
    Nov 25, 2017
    Posts:
    4
    Is there a way to find out which rigidbody is violating this rule? I really don't mind changing to/from kinematic and changing collision detection via code but I have absolutely no idea what game object (or is it a prefab?) is bringing up this error.
     
  4. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,508
    Clicking the error line in the Console should take you to the offending gameobject. If it doesn't then it's a bug.
     
  5. hartjoshua

    hartjoshua

    Joined:
    Mar 3, 2018
    Posts:
    1
    Seeing this bug, can someone assist me in getting this reported/solved so that I can test my build?
     
  6. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,195
    Don't really count on it being a bug. You can fix this in two ways:
    • If you have any rigidbodies in your scenes, make sure their Collision Detection Mode is set to Discrete, or I think Continuous Speculative is also okay.
    • If you're setting a rigidbody to kinematic in code, first change its collision detection mode or you'll get this error at runtime.
     
  7. Unsui

    Unsui

    Joined:
    Oct 10, 2017
    Posts:
    4
    I have Collision Detection Mode is Discrete
    But still get this issue
     
  8. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,195
    Are you changing isKinematic in code? Or are you seeing this in the console while in the Unity editor? Most likely there's just a rigidbody you've overlooked.
     
  9. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    The issue probably has something to do with Contact Pairs Mode. Since it can't very well do speculative contacts otherwise, so the warning is likely before this functionality was added.

    @yant or @MelvMay could provide insight if not too busy :)
     
  10. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,073
    My opinion is same as OP.
    Setting/unsetting IsKinematic should not give you any error or even a warning.
     
    Edy likes this.
  11. smonchdev0

    smonchdev0

    Joined:
    Sep 25, 2018
    Posts:
    8
    I have the same issue with 2018.3.0f2 when I load certain scenes that contain Rigidbodies. I've checked the Rigidbodies two different ways and none of them should trigger this error.

    First searching via the Hierarchy with t:rigidbody and then manually checking each result.

    Then with editor code that roughly looks like this... and although they're not shown here, I sanity checked and listed the opposite results as well.

    Code (CSharp):
    1. [MenuItem("Tools/Count Rigidbodies")]
    2. static void CountRigidbodies()
    3. {
    4.     var result = GameObject
    5.         .FindObjectsOfType<Rigidbody>()
    6.         .Where(body => body.collisionDetectionMode != CollisionDetectionMode.Discrete)
    7.         .Count();
    8.  
    9.     Debug.Log($"Count: {result}");
    10. }
    It'd be nice if the editor would provide any information at all about the offending objects, especially since they don't appear to be easy to find. This looks like a bug to me, but am hoping someone may have more information or perhaps a quick workaround. Thanks!
     
  12. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Has anyone got a bug report number I can highlight for Unity to peep at? they would love to see it...
     
    jashan likes this.
  13. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    97
    I get this frequently on 2018.3, good to know its nothing serious haha. Does anybody know the reason its not supported, out of curiousity?
     
  14. smonchdev0

    smonchdev0

    Joined:
    Sep 25, 2018
    Posts:
    8
    Thanks! I just filed a new report. There's no link yet, but here's the info... title's cut off:
    (Case 1115155) Can't build due to erroneous error: "kinematic bodies with CCD enabled are not supported

    And this is what's in it...

    Description:

    Builds are failing due to the following error:
    [Physics.PhysX] RigidBody::setRigidBodyFlag: kinematic bodies with CCD enabled are not supported! CCD will be ignored.

    The error is also triggered both when loading a scene in the Editor and when loading in Play Mode.
    Some scenes trigger this error and some don't. Those that do, always do, and those that don't, never do.

    I've ensured that all kinematic Rigidbodies in a given scene are using discrete collision detection and no interpolation.
    I've searched for Rigidbodies using the following two methods:

    1. Searching via the Hierarchy with t:rigidbody as the query and then manually checking each result.
    2. Using editor code similar to this:

    var result = GameObject
    .FindObjectsOfType<Rigidbody>()
    .Where(body => body.collisionDetectionMode != CollisionDetectionMode.Discrete)
    .Count();

    Searching the forums, it's fairly obvious that I'm not the only one encountering this issue.
    Also, there is a similar bug report indicating that a fix may be one the way, but that report's scope is limited to Play Mode.

    Steps To Repro:

    Unfortunately, I have no idea how to recreate this situation. For what it's worth, my project has been upgraded across multiple versions of Unity. The last two versions were 2018.2 and 2017.4.
    2018.3 is the first build in which I've encountered this situation.

    Expected Results:

    At minimum, the project needs to build without failing over something that looks more like a warning than an error. But it really looks like it shouldn't be getting triggered in the first place.

    Thanks in advance! Really need to get builds out to multiple platforms ASAP. A quick patch release would be great if possible!
     
    Squize and Hagen like this.
  15. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,508
    By definition kinematic rigidbodies don't react to collisions themselves, to start with. Position and rotation are entirely script driven. If you move a kinematic rigidbody from A to B (via Rigidbody.MovePosition) then at the end of the frame it will be at B no matter all other rigidbodies and colliders present in the scene. Only visual interpolation will be applied if enabled.
     
    Subliminum likes this.
  16. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,508
    So if a kinematic rigidbody has CCD also enabled, it should silently keep acting as a kinematic rigidbody. No warning nor error make sense here. Once the kinematic flag is cleared, then the rb could start acting as a regular physics-driven rigibdody applying CCD and all other options.
     
    Subliminum and Rohirm like this.
  17. smonchdev0

    smonchdev0

    Joined:
    Sep 25, 2018
    Posts:
    8
    Problem solved!!! But it still looks like a bug. Turns out I had instances of a problematic prefab being used in several scenes. I think I manually overrode it in all the scenes as I was transitioning to Unity 2018.3 and trying to fix a huge volume of compiler warnings and errors involved with virtually any major Unity upgrade. Unity complained about the CCD issue and I removed the Rigidbody because it wasn't actually even being used at this point. Would've made sense to hit it from the prefab level, but that didn't happen... until just now. In any case, it looks like Unity is complaining about what it sees at the prefab level regardless of whether or not an instance has been overridden to correct a situation. So that's why I didn't find the issue with the methods I mentioned above.
     
    kateng and Subliminum like this.
  18. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    97
    Don't they still use that information for collision detection even when kinematic? I'm wondering since an Asset im using specifically tells you to have CCD and kinematic enabled for melee weapons. I assumed this was because collision detection or triggering would be more accurate in this mode as opposed to discrete.
     
  19. smonchdev0

    smonchdev0

    Joined:
    Sep 25, 2018
    Posts:
    8
    The way I understand it and please correct me if I'm wrong... kinematic bodies operate roughly the same as non-kinematic bodies when it comes to collision detection. My guess is that the engine would see them hopping through space like regular discrete bodies with maybe a slightly wobbly velocity (calculated via distance traveled) from one step to the next. Interactions have to be handled manually from the perspective of a kinematic body, but from the perspective of other others, it should be about the same. If the hop is too extreme, then you'd get tunneling and it'd seem like things aren't working. I'm not sure why CCD wouldn't be possible other than maybe it's too clunky with a wobbly velocity? FWIW I'm guessing about that... haven't tested it. Maybe the reason speculative collision detection is ok, is because it's roughly the same as discrete except that the bounding boxes are padded per step in a speculative manner.
     
    Subliminum likes this.
  20. Alexander21

    Alexander21

    Joined:
    Dec 14, 2015
    Posts:
    302
    Hi All

    I am trying for Apk in unity 2018.3 Version. But i have received the above error +few new errors.

    UnauthorizedAccessException: Access to the path "D:\" is denied.

    EntryPointNotFoundException: StartIosProxy

    Could not start remote support for device: EntryPointNotFoundException:
    StartIosProxy


    I have also attached the image with it.

    WHAT IS THE SOLUTION FOR THAT ERROR.

    IS IT BUG IN UNITY 2018? APK IS NOT PRODUCED....
     

    Attached Files:

  21. RickBeniers

    RickBeniers

    Joined:
    Sep 25, 2018
    Posts:
    4
    I had the same issue about the CCD but even when all rigid bodies where set to use gravity and were set to discrete the errors never went away and I still could not run my scene, I accidentally fixed this by running a prefab as a scene and because I always use Clear on play the errors disappeared. Since then I can run my scene with no problems or issues.
     
  22. thatscraigz

    thatscraigz

    Joined:
    Mar 27, 2015
    Posts:
    100
    @RickBeniers

    Hi Rick! Could you clarify this a little bit more?
    " I accidentally fixed this by running a prefab as a scene "

    Thank you :)
     
  23. RickBeniers

    RickBeniers

    Joined:
    Sep 25, 2018
    Posts:
    4
    in my version of unity I can open prefabs(did not know this was possible) when I opened a prefab the error messages disappeared.
     
  24. Lewnatic

    Lewnatic

    Joined:
    Sep 29, 2012
    Posts:
    209
    Also got this error here. Unity 2018.3 is a total mess.
     
  25. thatscraigz

    thatscraigz

    Joined:
    Mar 27, 2015
    Posts:
    100
  26. Alexander21

    Alexander21

    Joined:
    Dec 14, 2015
    Posts:
    302
    Actually While Building windows in unity 2018.... I have received this error. I have searched in google. no solutions are there. So i build my android project in unity 2018 in mac OS.

    and that produce that apk ... But some times .. the above error is coming. but it bye passes and produced the apk....

    So for just temporary solutions... BUILD THE ANDROID PROJECT IN UNITY MAC OS...INSTEAD OF RUNNING IN WINDOWS...
     
  27. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    There is also a public issue available here:

    "RIGIDBODY::SETRIGIDBODYFLAG: KINEMATIC BODIES WITH CCD ENABLED ARE NOT SUPPORTED!" ERROR THROWN DURING PLAYMODE

    (I don't know who had the wonderful idea to make these titles all caps on the Issue Tracker :-/ ).

    This is apparently fixed in 2019.1, which is currently in beta.

    Quite an annoying issue :-/

    EDIT: I haven't tried this, yet, but here's an editor script that can be used to fix this: Unity3D 2018.3 Editor script to find PhysX CCD problems · GitHub
     
    hippocoder likes this.
  28. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Anthony mentioned that 2018.3 physx upgrade is getting a few crashes so he's definitely looking at things and poking them with a stick.
     
  29. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Gettting this in 2018.3.6

    Kinematic body only supports Speculative Continuous collision detection
     
  30. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    I see it for lines like, RigidBody.isKinematic = true

    But also were I instance a prefab with a rigidbody attached

    var instance = (GameObject)GameObject.Instantiate(obj, position ?? obj.transform.position, rotation ?? obj.transform.rotation);
     
  31. dsharrock

    dsharrock

    Joined:
    Aug 29, 2018
    Posts:
    2
    I had this error for weeks and could not figure out where it was or why it occurred on some scenes and not others.

    The error only appeared in Edit mode not Play mode.

    I've finally found it, I had the Kinematic box ticked on the rigidbody for a bullet prefab that was being used by one of the player in the scenes. Because it was on an instantiated prefab, it couldn't be found with a hierarchy search.
     
  32. davidnibi

    davidnibi

    Joined:
    Dec 19, 2012
    Posts:
    426
    I'm getting this error:

    Assets\editor\PhysXCCDEditorHelper.cs(127,5): error CS0103: The name 'Assert' does not exist in the current context

    Have no idea what it means, assume missing reference
     
  33. KevinCastejon

    KevinCastejon

    Joined:
    Aug 10, 2021
    Posts:
    98
    Same problem 5 years later with Unity 2023.2.11...
     
  34. Saulotti

    Saulotti

    Joined:
    Oct 20, 2009
    Posts:
    19
    oh yes... 2024 and still not a fix for this.