Obi Official Forum
Help I want to know the times. - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Fluid (https://obi.virtualmethodstudio.com/forum/forum-3.html)
+--- Thread: Help I want to know the times. (/thread-2586.html)



I want to know the times. - dabinzzang - 21-11-2020

I'm scattering 5,000 water particles on the floor.
every single 5,000 water particles, from the emitter to hitting the floor, are taken time. so i want to know the times one by one.
To sum up, I would like to know the time it took from the time 5,000 water particles were collided to the floor (total a number of 5,000 times).
I think i should write a script in 'CollisionEventHandler', and I'd like to know how to do it. Huh


RE: I want to know the times. - josemendez - 27-11-2020

(21-11-2020, 05:29 PM)dabinzzang Wrote: I'm scattering 5,000 water particles on the floor.
every single 5,000 water particles, from the emitter to hitting the floor, are taken time. so i want to know the times one by one.
To sum up, I would like to know the time it took from the time 5,000 water particles were collided to the floor (total a number of 5,000 times).
I think i should write a script in 'CollisionEventHandler', and I'd like to know how to do it. Huh

Hi there,

This is a basic programming question, not really Obi-specific.

You should keep some kind of timer for each particle (lots of options here: accumulate Time.fixedDeltaTime, take a difference of two measures of Time.time, etc). Start counting time when a particle is spawned (you can use emitter's OnEmitParticle event for this) and stop it when the particle hits the floor collider.

Depending on your needs, you could also keep a single timer: start counting when the first particle is emitted and stop counting when the last one hits the collider.