Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Accuracy of collision detection

Discussion in 'Physics' started by mbaske, Mar 21, 2019.

  1. mbaske

    mbaske

    Joined:
    Dec 31, 2017
    Posts:
    473
    I noticed that small objects, like for instance bullets with sphere colliders, can pass through larger colliders if they are moving fast enough. My guess is that has to do with the temporal resolution of the physics engine. Is the engine really just looking for colliders at discrete points along a bullet's path, rather than doing a continuous collision check? What's the best way to deal with this, without resorting to having additional raycast tests? Thanks.
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,321
    Yes, if the body is set to use discrete collision detection mode.

    It'll do this if you use continuous collision detection mode.

    Here's the detail in the docs: https://docs.unity3d.com/ScriptReference/Rigidbody-collisionDetectionMode.html
     
    GordH and mbaske like this.
  3. GordH

    GordH

    Joined:
    Jan 28, 2021
    Posts:
    2
    Could I ask your advice sir. I am trying to accurately detect a mallet hitting VR vibraphone or Marimba type keys to make sounds in Unity XR. So far as a complete unity newbie I am having trouble with accurate collision detection. Have you experimented much with the heavier process "Collision Detection Mode.Continuous Dynamic" versus the "Collision Detection Mode.Continuous"? Just trying to save some time here..... or am I wasting my time even trying with something designed more for opening game doors?
     
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,321
    Unfortunately I'm not a 3D physics dev so I'm can't help you much on this subject.

    You should post your own thread and try not hijack others though. At least this way it's likely to gert answered by other devs.