Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Counting Particles
#2
(13-10-2018, 03:33 AM)docgonzzo Wrote: Hi There,

I'm working on a 2D game (Unity) about transferring fluid from one cup to another cup.

To measure success, I need to count the number of particles that were transferred from the 1st cup to the 2nd cup. Currently, I am subscribing to the Solver.OnCollision event. I have a "Trigger=true" BoxCollider2D inside the 2nd cup that I compare with the event callback Collider. My code is very similar to the code shown in this thread:

http://obi.virtualmethodstudio.com/forum...=collision


My problem is that the "count" is never actually correct. It seems to be always less than the actual count. I'm wondering if there's possibly collisions not being detected? I have my Fixed TimeStep set to 0.005.

The transfer can be violent and quick sometimes, but the fluid never clips out of the cup. I'm only using 55 particles.

Hi there,

The trigger will not miss collisions. Also, the counting script in that thread takes all particles added during each simulation step into account, so the culprit must be elsewhere.

We made some simple tests in 2D with this script, and no collisions are being missed. The FluidFoam sample scene for instance, correctly reports 2500 hits when placing a small cube near the fluid nozzle. My only advice for now would be to make sure your trigger collider is big enough for tunneling (particles jumping over it during consecutive physics steps) to not take place. Let me know if the issue persists.
Reply


Messages In This Thread
Counting Particles - by docgonzzo - 13-10-2018, 03:33 AM
RE: Counting Particles - by josemendez - 13-10-2018, 08:58 AM
RE: Counting Particles - by docgonzzo - 16-10-2018, 12:25 AM
RE: Counting Particles - by josemendez - 17-10-2018, 08:29 AM