Miarmy Crowd Simulation Documentation (English)

Aggregate Optimization

Aggregate is the latest feature of PhysX, it's a mechanism can speed up the collision detection tremendously. The More agents in scene, the more times you save.
In physical simulation, the rag dolls are consisted of a group of rigid bodies and dynamic constrains. The collision detection in regular circumstance is based on each one of rigid body. Let's make a very simple example:
There are 2 agents, each one contains 10 bones. If PhysX engine checks collide for them, they will check each bone whether have collide others bone, so there should be 10 by 10 (divide 2) possible pair of collide need to (10 * 10 / 2 = 50 times) check. But sometimes if there are several hundreds of agents, this process needs to be simplified.
PhysX offer an aggregate mechanism:
Aggregate have 2 main features can speed up for above process:

  • Grouping for agent level: group all bones of one agent to an aggregate and assign it a bounding box, the agent is the first level, and the bodies inside are second level. When checking collision, the rigid objects will test that bounding box in first level, if collide against bounding box, it will go into for checking inner bodies in second level.
  • Disable self-collision: all rigid bodies in one aggregate can disable collide each other and just leave the dynamic constrains control the dynamics

In Miarmy since version 1.5, the aggregate will be default and automatically created when agents enable dynamics (Notice: only available for the agents have less than 128 bones)
Let's take a look at the following example:
When then rigid body check collide, it will firstly test the red bounding box then test the inner rigid bodies, the bounding box is able to fit the size automatically.
The arm in yellow circle will check bounding box and it collide one bonding box, then only check collide with the bodies in bounding box.
The arm in green circle will only check collide with the bounding box, no further possible collide, just ignore it



The red bounding boxes are aggregates; it can dynamically fit the size


By default we disable the self-collide in aggregate. You need turn that on if you need it, in Physics Global








Basefount Technology