I am trying to find out the best way to simulate physics using a large number of pathfinding agents (roughly 5000). I have been tweaking the settings on the physics body component and messing around with other settings, but am curious if there are any suggestions on setup when doing this.
I assume the engine is much more optimized than I would be able to quickly script for such a use case, so am trying to avoid doing so.
the physics doesn’t have to be very precise because the agents are very hectic in their motion and in-accuracies likely wouldn’t be noticed. I would even go as far as saying a simple capsule overlap positional adjustment would be okay.
I am currently using these settings:
the motion type on the bodies to Dynamic, no smoothing. Also, they are using gravity.
for the Physics Shape, I am using a box collider with the bevel radius maxed (I assumed this was more efficient than a strict box, as the sides could use point distance checks to determine overlap, but I may be wrong.)
I have the collision response on Collide. Friction at .5 and restitution at 0.
Are there any settings that would drastically improve the performance of the physics engine? If compromising collision check quality, that is okay! like I said it isn’t super important, less so than the number of units.
Also, not sure if the engine already does this, but with so many units I was considering implementing a LOD-type precision system where further away units update less frequently and at a lower solver iteration or even drop the physics altogether and just run local avoidance calculations, but haven’t tried implementing a system like that yet. Another idea that came to mind is using very simple sphere checks for a collision at a certain distance, and within a certain area from the player, a slightly more complex collider be used.
Anyway, I would love to hear anything about what would make the current physics shape and body most efficient.
contentharshlabradorretriever