Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error when using mesh colliders
#1
I'm getting this error when trying to use a mesh collider with an obi collider. It's just a simple cylinder. The error disappears if I use the primitive colliders. Why is this? (Obi rope 5.6.1)

Code:
IndexOutOfRangeException: Index was outside the bounds of the array.
Obi.BIH.Build (Obi.IBounded[]& elements, System.Int32 maxDepth, System.Single maxOverlap) (at Assets/Obi/Scripts/Common/DataStructures/BVH/BIH.cs:63)
Obi.ObiTriangleMeshContainer.GetOrCreateTriangleMesh (UnityEngine.Mesh source) (at Assets/Obi/Scripts/Common/Collisions/ObiTriangleMeshContainer.cs:92)
Obi.ObiColliderWorld.GetOrCreateTriangleMesh (UnityEngine.Mesh mesh) (at Assets/Obi/Scripts/Common/Collisions/ObiColliderWorld.cs:229)
Obi.ObiMeshShapeTracker.UpdateIfNeeded () (at Assets/Obi/Scripts/Common/Collisions/ColliderTrackers/Trackers3D/ObiMeshShapeTracker.cs:38)
Obi.ObiColliderBase.UpdateIfNeeded () (at Assets/Obi/Scripts/Common/Collisions/ObiColliderBase.cs:189)
Obi.ObiColliderWorld.UpdateWorld () (at Assets/Obi/Scripts/Common/Collisions/ObiColliderWorld.cs:362)
Obi.ObiUpdater.BeginStep (System.Single stepDeltaTime) (at Assets/Obi/Scripts/Common/Updaters/ObiUpdater.cs:40)
Obi.ObiFixedUpdater.FixedUpdate () (at Assets/Obi/Scripts/Common/Updaters/ObiFixedUpdater.cs:54)
Reply
#2
(02-12-2020, 07:10 AM)SkyDash Wrote: I'm getting this error when trying to use a mesh collider with an obi collider. It's just a simple cylinder. The error disappears if I use the primitive colliders. Why is this? (Obi rope 5.6.1)

Code:
IndexOutOfRangeException: Index was outside the bounds of the array.
Obi.BIH.Build (Obi.IBounded[]& elements, System.Int32 maxDepth, System.Single maxOverlap) (at Assets/Obi/Scripts/Common/DataStructures/BVH/BIH.cs:63)
Obi.ObiTriangleMeshContainer.GetOrCreateTriangleMesh (UnityEngine.Mesh source) (at Assets/Obi/Scripts/Common/Collisions/ObiTriangleMeshContainer.cs:92)
Obi.ObiColliderWorld.GetOrCreateTriangleMesh (UnityEngine.Mesh mesh) (at Assets/Obi/Scripts/Common/Collisions/ObiColliderWorld.cs:229)
Obi.ObiMeshShapeTracker.UpdateIfNeeded () (at Assets/Obi/Scripts/Common/Collisions/ColliderTrackers/Trackers3D/ObiMeshShapeTracker.cs:38)
Obi.ObiColliderBase.UpdateIfNeeded () (at Assets/Obi/Scripts/Common/Collisions/ObiColliderBase.cs:189)
Obi.ObiColliderWorld.UpdateWorld () (at Assets/Obi/Scripts/Common/Collisions/ObiColliderWorld.cs:362)
Obi.ObiUpdater.BeginStep (System.Single stepDeltaTime) (at Assets/Obi/Scripts/Common/Updaters/ObiUpdater.cs:40)
Obi.ObiFixedUpdater.FixedUpdate () (at Assets/Obi/Scripts/Common/Updaters/ObiFixedUpdater.cs:54)

It's a known bug, the fix will be included in 5.6.2 (not yet approved by the store).

To fix it, replace BIH.cs with the one you'll find in this thread:
http://obi.virtualmethodstudio.com/forum...-2592.html
Reply
#3
(02-12-2020, 08:33 AM)josemendez Wrote: It's a known bug, the fix will be included in 5.6.2 (not yet approved by the store).

To fix it, replace BIH.cs with the one you'll find in this thread:
http://obi.virtualmethodstudio.com/forum...-2592.html

That fixed the problem but when I use mesh colliders the simulation is not as good as using primitive colliders. I'm getting some extreme tunnelling. Any solution to this?
Reply
#4
(02-12-2020, 10:29 AM)SkyDash Wrote: That fixed the problem but when I use mesh colliders the simulation is not as good as using primitive colliders. I'm getting some extreme tunnelling. Any solution to this?

MeshColliders are quite costly. They're also hollow: only their surface is considered for collision detection. So if an object (in Obi's case, particles) gets completely inside of them, it won't be projected out. This applies both to Unity physics as well as Obi. Increasing ObiCollider's thickness and/or using a shorter timestep you could improve this a bit, but unfortunately it's just how MeshColliders work.

Obi provides a better alternative to MeshColliders: distance fields. They're much faster and considerably more robust to tunneling, both convex and concave shapes are supported. You can read more about them here:
http://obi.virtualmethodstudio.com/tutor...ields.html
Reply