Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  Error on FixedUpdate after upgrading to Obi 5.6.1
#1
I recently tried to upgrade one of my projects from Obi 5.6.0 to 5.6.1 (I'm using Fluid and Rope) and I now get many instances of this error when starting Play mode (with either Burst or Oni):

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)


I tried one of the Sample programs (FaucetAndBucket) while in my project and got some different results. With the Burst solver, I get this:

Code:
IndexOutOfRangeException: Index 0 is out of range of '0' Length.
Unity.Collections.NativeArray`1[T].FailOutOfRangeError (System.Int32 index) (at <526469d5a48c43eebd9af19f8745afa1>:0)
Unity.Collections.NativeArray`1[T].CheckElementReadAccess (System.Int32 index) (at <526469d5a48c43eebd9af19f8745afa1>:0)
Unity.Collections.NativeArray`1[T].get_Item (System.Int32 index) (at <526469d5a48c43eebd9af19f8745afa1>:0)
Obi.BurstDistanceField.DFTraverse (Unity.Mathematics.float4 particlePosition, System.Int32 nodeIndex, Obi.DistanceFieldHeader& header, Unity.Collections.NativeArray`1[Obi.BurstDFNode]& dfNodes) (at Assets/Obi/Scripts/Common/Backends/Burst/Collisions/BurstDistanceField.cs:50)
Obi.BurstDistanceField.Contacts (System.Int32 particleIndex, System.Int32 colliderIndex, Unity.Mathematics.float4 position, Unity.Mathematics.quaternion orientation, Unity.Mathematics.float4 radii, Unity.Collections.NativeArray`1[Obi.BurstDFNode]& dfNodes, Obi.DistanceFieldHeader header, Obi.BurstAffineTransform colliderToSolver, Obi.BurstColliderShape shape, Unity.Collections.NativeQueue`1+ParallelWriter[T] contacts) (at Assets/Obi/Scripts/Common/Backends/Burst/Collisions/BurstDistanceField.cs:33)
Obi.BurstColliderWorld+GenerateContactsJob.GenerateContacts (Obi.ColliderShape+ShapeType colliderType, System.Int32 particleIndex, System.Int32 colliderIndex, Unity.Mathematics.float4 particlePosition, Unity.Mathematics.quaternion particleOrientation, Unity.Mathematics.float4 particleVelocity, Unity.Mathematics.float4 particleRadii, Obi.BurstAffineTransform colliderToSolver, Obi.BurstColliderShape shape, Unity.Collections.NativeQueue`1+ParallelWriter[T] contacts, System.Single dt) (at Assets/Obi/Scripts/Common/Backends/Burst/Collisions/BurstColliderWorld.cs:408)
Obi.BurstColliderWorld+GenerateContactsJob.Execute (System.Int32 i) (at Assets/Obi/Scripts/Common/Backends/Burst/Collisions/BurstColliderWorld.cs:328)
Unity.Jobs.IJobParallelForExtensions+ParallelForJobStruct`1[T].Execute (T& jobData, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at <526469d5a48c43eebd9af19f8745afa1>:0)

If I try to run that sample with the Oni solver, Unity just crashes immediately.


However, I'm not able to recreate these issues in a fresh project - the sample scene works fine with either Burst or Oni. I've tried reinstalling the Obi package in my problem project (and deleting/rebuilding the Library in case something was cached) but get the same results.

Do you have any idea what would be causing these errors, if there might be some setting or misconfiguration that would cause this to start happening now when it was fine in 5.6.0? Thanks.
Reply
#2
Hi there,

Not much changed from 5.6.0 to 5.6.1. Mostly bug fixes and small improvements.

Only thing I can think of is serialized data got corrupted while updating, Unity sometimes does this. Try selecting Obi/Samples/Common/SampleResources/DistanceFields/EnvironmentDF.asset (which is the distance field for the environment collider in most sample scenes) and click the "Generate" button in the inspector. This will regenerate the distance field data (will take a while), and hopefully solve this.

Let me know how it goes!
Reply
#3
Okay, that fixed the issues with the sample scenes. I'm still getting that first error in my actual scene though (something about building a triangle mesh?), and I'm not using any distance fields there. I'll keep playing around with things and see if I can track it down.
Reply
#4
(26-11-2020, 02:15 PM)Softscale Wrote: Okay, that fixed the issues with the sample scenes. I'm still getting that first error in my actual scene though (something about building a triangle mesh?), and I'm not using any distance fields there. I'll keep playing around with things and see if I can track it down.

There's a known bug with bounding interval hierarchies (the data structure used to store mesh colliders) whose fix that has yet to be included in the published version. Might (might not) be the culprit, but trying won't hurt.

Could you try replacing your /Obi/Scripts/Common/DataStructures/BVH/BIH.cs file with the one attached? Let me know if this improves the situation.


Attached Files
.cs   BIH.cs (Size: 11.97 KB / Downloads: 26)
Reply
#5
Oh, that fixed it. Thanks!
Reply
#6
You're welcome! Sonrisa
Reply
#7
(26-11-2020, 02:19 PM)josemendez Wrote: There's a known bug with bounding interval hierarchies (the data structure used to store mesh colliders) whose fix that has yet to be included in the published version. Might (might not) be the culprit, but trying won't hurt.

Could you try replacing your /Obi/Scripts/Common/DataStructures/BVH/BIH.cs file with the one attached? Let me know if this improves the situation.
Had the same problem, this file fixed it too, thanks  Sonrisa
Reply