hmihalis1 Posted April 29, 2020 Share Posted April 29, 2020 Hi all, I'm trying to come up with some vex to use to kill particles in a sim when they have traveled a certain distance from their birth location. I have mother particles that last one frame and i'm using a pop replicate to spawn new splash particles from them. What i'd like to do is store the position of the mother particles and subtract it from the position of each replicated particle every frame to get the distance, then set them as dead once this has passed a given threshold. Extremely limited VEX experience here, so if anyone could give me some kind of starting hint/snippet that would be amazing Many thanks, H Quote Link to comment Share on other sites More sharing options...
Noobini Posted April 29, 2020 Share Posted April 29, 2020 here's a simple one, can guarantee won't win any award for technical excellence not answering you directly with VEX tho, it's mostly done via pop nodes and a one liner VEX. vu_popkillbydist.hiplc Quote Link to comment Share on other sites More sharing options...
hmihalis1 Posted April 29, 2020 Author Share Posted April 29, 2020 (edited) Hi @Noobini Thanks for your response! Right now I have this situation: //Rounding my particle age up to get the frame number (no idea if this maths is right): f@frameAge = ceil(f@age*24); //if frameAge is 1 save the startPos: if(@frame == 1){ v@startPos = v@P; } //Then get vector length and kill if it exceeds threshold: f@distance = (float)abs(v@startPos - v@P); if(distance > ch("threshold")){ @dead = 1; } Do you think this makes sense? Not confident i'm getting the vector length correctly. I'll check your solution now. Thanks so much! Edited April 29, 2020 by hmihalis1 Quote Link to comment Share on other sites More sharing options...
Noobini Posted April 29, 2020 Share Posted April 29, 2020 i'll leave it to the VEX experts, otherwise might lead you up the creek without a paddle. Quote Link to comment Share on other sites More sharing options...
hmihalis1 Posted April 29, 2020 Author Share Posted April 29, 2020 Ok thanks it seems to work kind of but also deletes points i want to keep so i'll try your solution now Quote Link to comment Share on other sites More sharing options...
Noobini Posted April 29, 2020 Share Posted April 29, 2020 Just now, hmihalis1 said: Ok thanks it seems to work kind of but also deletes points i want to keep so i'll try your solution now then you prolly just need to make sure you group 'mothers' and 'children' particles properly...then do whatever to certain groups. Quote Link to comment Share on other sites More sharing options...
hmihalis1 Posted April 29, 2020 Author Share Posted April 29, 2020 15 minutes ago, Noobini said: then you prolly just need to make sure you group 'mothers' and 'children' particles properly...then do whatever to certain groups. I combined your code and this seems to have the desired effect: f@distance = (float)abs(length(v@startPos - v@P)); if(f@distance > ch("distance_threshold")){ @dead = 1; } will make sure to set up the groups properly. still new to pops and getting my head around streams etc Quote Link to comment Share on other sites More sharing options...
Noobini Posted April 29, 2020 Share Posted April 29, 2020 length is absolute already so you can remove abs Quote Link to comment Share on other sites More sharing options...
Noobini Posted April 29, 2020 Share Posted April 29, 2020 aside question for the experts: why in popcolor it's using color instead of the obligatory Cd ? Quote Link to comment Share on other sites More sharing options...
anim Posted April 29, 2020 Share Posted April 29, 2020 2 minutes ago, Noobini said: why in popcolor it's using color instead of the obligatory Cd ? because color is a variable, not the name of the attribute, it still creates v@Cd and f@Alpha in different modes it uses variables like seed or ramp it's how VEXpressions are designed, they allow you to modify certain data that's used within the bigger VOP network, normally input parameters that flow into snippet VOP, and SESI tries to preserve the names of the parameters so that it's a bit intuitive so color variable contains the color parameter value and you can either use or overwrite it within that VEXpression, the result will be written to v@Cd Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.