Put particle in group for x frames?

   2944   7   0
User Avatar
Member
33 posts
Joined: Sept. 2009
Offline
hello,

I'm stuck on a problem and not sure if pops is the solution.

I am driving particle velocity via popVop to a goal. When the particle gets within 10 units of the goal I want the particles to be advected by a fluid for say 20 frames and then continue on to the goal. I was thinking of putting the particles in a group for 20 frames to get the fluid advection.
Not sure how to do this?

Is there a way to put particles in a group for x frames?

Tia
User Avatar
Member
8554 posts
Joined: July 2007
Offline
you can create and attribute like start_frame make default very low like -1e9

then when particle triggers the condition set it to current floating frame
from that point don't allow the start_frame to update
(so condition would be like: distance to goal < 10 and start_frame == -1e9, in this case it will update only once since second part of the condition will not be true after first update)

then just create non-persistent group with the condition like:
$FF < ($START_FRAME + 20)
this will be true only for 20 frames since start_frame was set and so the point will be in group just 20 frames

use that group for your advection

there is plenty of other ways how you can do this
and if you were looking for Remove From Group VOP, there is removegroup() vex function you can use to remove particles from groups, so just use it in Inline VOP for that purpose.
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
33 posts
Joined: Sept. 2009
Offline
Wow thanks Thomas!
I started playing with a bounding box as a collision
Pass-thru and using hittime.

I think your way is more elegant for me
I no sure why the initial value should be soo small
But I will play around and learn from it.

Thank you soo much for help
User Avatar
Member
8554 posts
Joined: July 2007
Offline
it doesn't have to be so small, but because of the condition
$FF < ( $START_FRAME + n )
you certainly want it smaler than -n, othervise the initial value would satisfy that condition on early frames if you are starting from 0 or 1
so making it extremely small you are simply avoiding those problems when n is an user defined variable
and it's easier to realise that that's an extreme
if you have put -100 in there, anybody can wonder why is -100 in there, if it's extremely small number, it's kind of logical
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
33 posts
Joined: Sept. 2009
Offline
ahh that makes sense. thanks for esplaing!
I played around with this setup, i'm getting good results. thank you!
User Avatar
Member
33 posts
Joined: Sept. 2009
Offline
hi,

is there an example or thread somewhere that talks about inlinevop and removepoint from group? I did look at the inline vop but got intimidated but the include files bit, if i even need it?
User Avatar
Member
8554 posts
Joined: July 2007
Offline
you may find some examples on forums
but it's very simple, usually you don't care about include files
just plug inputs to inline vop
setup your output names and types if you want some outputs

then just write inline code in normal VEX, refering to inputs and outputs as variables starting with $

here is simple example including remove group, using some inputs and outputs and internal variables, but really just for you to see the usage, as a tool it makes no sense and notice that internally defined variables are used without $, like in normal VEX

Attachments:
inline_remove_from_group.hip (69.1 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
33 posts
Joined: Sept. 2009
Offline
Wow thanks so much tamte!
  • Quick Links