Jump to content

Emit 1 Particle Per Sec - Starting From Frame 1


Recommended Posts

Hello helpful wizards!

As the title says, I'd like to emit one particle per second, with the first particle being emitted on frame 1.
I'm currently making use of the 'constant birth rate' setting, as I would eventually like to be able to adjust this to say, 10 per sec, or 0.5 per sec.

My problem is, the first particle doesn't emit until after the first second has elapsed. How can I begin emission on frame 1 instead of waiting?

The only way I can get a similar result is by using 'all points' emission type and setting the 'impulse activation' to 1 - Although this does not give me the control I'm after by wanting to emit 1 particle per second, or 10 per sec, or 0.5 per sec.

Here is a very simple .hip file
emit_particles.hipnc

Edited by GlennimusPrime
Link to comment
Share on other sites

Try setting the source emission type to "All Points" and try this expression in the impulse activation field.

$SF%$FPS==1

By referencing the FPS, you can determine what one second is.

one_per_second.gif

Link to comment
Share on other sites

You could tell the DOP Network to start the simulation one second earlier so you have your first particle on the first frame. Just use a negative frame number on the Start Frame parameter.

Link to comment
Share on other sites

You control the point input count. Just use a scatter before the popnet instead of an add to set the number of points per second. Or do the math to alter the expression. $FPS defaults to 24. $SF%24==1 is one per second. $SF%12==1 is two per second.

Edited by Atom
  • Like 1
Link to comment
Share on other sites

I've been working with controlling the input count like you've suggested @Atom, by removing the point when I don't want it firing with this vex:

if ($F % chi("shoot_every_frames")){
    removepoint(0,@ptnum);
}

Although I have the same issue with the first 'bullet' not firing on frame 1 (I also realise I will eventually have the issue of the bullet not firing when I toggle a 'fire' on/off attribute too).

I wasn't sure what you meant about using the scatter node - This wants to scatter points onto geometry right?

 

emit_particles_v02.hipnc

Link to comment
Share on other sites

The simplest fix might be to simply special case frame #1.

if(@Frame!=1){
    if ($FF % chi("shoot_every_frames")){
        removepoint(0,@ptnum);
    }
}

 

Link to comment
Share on other sites

Thanks @Atom! Making great progress!

I've also created a 'firing' toggle with your previous vex wrapped in another if statement (if firing == 1, shoot bullets, else remove all points).
 

int fire = chi("firing");

if(fire==1){
    if(@Frame!=1){
        if ($FF % chf("shoot_every_frames")){
            removepoint(0,@ptnum);
        }
    }
}
else{
    removepoint(0,@ptnum);
}

I think I now need to know which frame that fire toggle has been activated?

My thoughts are to replace:
'@Frame!=1`

With:
'@Frame!=@fire_activation_frame'

I just need to work out how to store that '@fire_activation_frame' attribute when the fire toggle is first set to 1.

Any ideas?

emit_particles_v03.hipnc

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...