Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Super slow fluid when enabling colliders
#4
(30-03-2021, 10:20 AM)sdpgames Wrote: That was fast cool!

We're using a few hundred colliders, mesh colliders, convex. I know what you think Sonrisa it works! it works fine and fast and great, 99.9% of the time. and then BOOOM

See the screenshot, I could catch it it's quite hard to catch on the profiler so I was a bit lucky there



Edit: the mega flush I'm talking about is

for (int i = 0; i < implementations.Count; ++i)
            {
                implementations[i].SetColliders(colliderShapes, colliderAabbs, colliderTransforms, 0);
                implementations[i].UpdateWorld(0);
            }

It seems the UpdateWorld is some sort of flush and is called n^2 when destroying a batch of colliders. I could be wrong, just my thought

Second update: I drew the time for each collider destruction to the next (faster one) from the profiler % info



It's not 1/n^2 exactly but it doesn't look linear to the number of colliders being destroyed

Hi,

Will try to reproduce this and get back to you. the UpdateWorld method looks at the end of the list (newly added or removed colliders), then adds or removed them to/from a  spatial partitioning structure. We use a multilevel hash grid, so insertions and deletions should be done in constant time too. If you disable 10 colliders, then 10 deletions from a hashmap will be performed next UpdateWorld is called.
Reply


Messages In This Thread
RE: Super slow fluid when enabling colliders - by josemendez - 30-03-2021, 01:06 PM