Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

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


    Jul 26, 2017
    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.