05-11-2019, 05:13 PM
(04-11-2019, 05:33 PM)josemendez Wrote: Particles with different phases generate contacts when coming close to each other. These contacts then have to be solved -as any other constraint- and that has its associated cost. Particles with the same phase basically ignore each other. Note that the number of phases you use has no performance impact whatsoever. They're simply flags that determine when to generate contact constraints. The actual amount of contacts generated as a result is what determines performance.
So ideally you'd want to have everything in the same phase, and only assign different phases to these particles that need to collide with each other. Having each particle have a different phase by default would be very detrimental to performance, as every particle could potentially generate contacts with all other particles. As you can imagine this becomes very costly, very quickly.
Writing a system that automatically assigns each object its own phase is kinda trivial. Check out the ball pool sample scene, as it does exactly this. It keeps track of how many balls have been spawned, and assigns a different phase to each one.
Thanks for the hint with the ball example. Exactly what I was looking for.
And thanks for the explanation!