Search Unity

Bug [IN-24501] Continuous Speculative Rigidbody with High Acceleration Freeze up Game/Editor

Discussion in 'Physics' started by CYCLE-6, Dec 4, 2022.

  1. CYCLE-6

    CYCLE-6

    Joined:
    Jul 26, 2017
    Posts:
    7
    Thx to Edy's suggestion, I'm resubmitting this issue as a bug. Also I've reported this issue through Unity Editor bug report. Case number "IN-24501"

    So in Unity 2021.3.13. I'm working with Rigidbody and AddForce function. I found out my game would randomly freeze up when triggering "explosion" in my game.

    Turns out it was the explosion force accidentally applied to some very small, very light objects with Rigidbody's collision detection is set to "continuous speculative" mode. The acceleration was too high and it freeze up my game.

    More specifically, it was the bullet casing drooped on the floor. I do have object pool will recycle casing after some time. But if an explosion occurs nearby before the casing got recycled, it will put the entire game into a freeze.

    It only happens if the Rigidbody collision detection is set to "continuous speculative" mode. I must've turned that option by accident.

    No errors, no warnings, and even the System.Diagnostics.Stopwatch will freeze so it won't give you the correct execution time of a function. This problem is very difficult to debug if you don't have prior knowledge and didn't pay attention to such a detail.

    I suggest that Unity should cap the max acceleration of an object and/or show an error message if a "continuous speculative" Rigidbody's acceleration is too high.