Can I ask @teasully and @ssellvf to try and make a really small repro project that shows this issue? You can strip out all sensitive data, we just need a demo that shows a collider disappearing and appearing randomly. Your 2 issues seem quite related, so even one repro could do the trick for us. We really want to get to the bottom of this but I’m out of ideas to ask about, need to see the code at this point. And thanks for answering all my questions, I know some of them were a long shot.
I was going to offer to do something similar. Is there an email address I could send it to, or just PM it to you over the Unity Forums when it is ready?
Edit: I sent you a direct message.
Thanks, will look at this first thing tomorrow!
So after taking a look at @ssellvf 's repro, we have some progress, so please @teasully also try to apply these and let us know:
There are 2 issues:
-
Locate CheckStaticBodyChangesJob and in the Execute method add a condition
|| chunk.DidOrderChange(m_LastSystemVersion)
This one is not that big but it causes stuff to disappear once in a while in the repro scene. We were already aware of this and it will probably be in the next release. -
Locate public Aabb CalculateAabb(RigidTransform transform) method in MeshCollider and add the following block at the beginning of that method:
if (!m_Aabb.IsValid)
{
return m_Aabb;
}
Now this is an interesting one. Empty AABBs can appear if some colliders in the scene are not valid for whatever reason. They will not collide with anything, and that’s fine. But without the fix above, they will mess up the entire bounding volume hierarchy since it is a spatial tree and it combines AABBs, and the method above ends up with NaNs without the fix. We will include the fix in the next release, but it’s best to take a look at your colliders and see which one has an empty AABB, since it will cost performance for no reason since it can’t affect the simulation.
I hope this fixes it for both of you. Let us know!
@petarmHavok Those changes fixed it!
A big thank you to you and everyone else who contributed in this thread, I really appreciate it.
Glad to hear it helped! We’ll include those fixes in the next release.
@teasully Please let us know the state of your project after these fixes!
I did not implement your fix but instead added a check when updating my PhysicsColliders. If the PhysicsCollider would be empty (0 verts), I remove the PhysicsCollider; this seems to do the job!