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

How does Havok deal with ghost collisions with speculative contacts?

Discussion in 'Physics for ECS' started by Mr-Mechanical, Nov 28, 2019.

  1. Mr-Mechanical

    Mr-Mechanical

    Joined:
    May 31, 2015
    Posts:
    507
    I understand speculative contacts can create ghost collisions. I am considering Havok Physics but I am curious how it solves this problem? What procedure is done to cure this ghost collisions effect?

    Thank you, I am intrigued and insight will be helpful.
     
  2. MaxAbernethy

    MaxAbernethy

    Joined:
    Mar 16, 2019
    Posts:
    53
    There are a couple of methods.

    One is to cast the body using its velocity at the beginning of the step and use the contact normal at the end of the cast instead of the starting position. This helps especially for near misses when the body shouldn't really hit anything. But, if the body does really hit something, then its velocity will change and it will no longer follow the path that it was cast along, so the other predicted collisions may not be correct anymore.

    Another way is to analyze the body's contact points collectively. For a simple example, suppose you have a flat quad made of two triangles. If a body is sitting on top of one triangle, it will get a sideways pointing normal from the other triangle's edge. That would create a contact plane that sticks up above the quad and could cause a ghost collision, but we can tell from the contacts with the first triangle that it won't hit that edge and adjust the normal to point upwards.

    These techniques do help, but they are not perfect, so ghost collisions and tunneling are still possible.
     
    Mr-Mechanical likes this.