post some code, it will help.
I would try to solve it by using 2 different technics :
- checking if I’m inside the contour,
- only emit if I’m inside the contour.
- check - for each particle - that it is inside the contour, if on edge case, a) invert the speed / axceleration, or b) make the particle invisible.
Step 3 is intensive, I’d recommend doing it for 50 particles, then once working properlly, put it into a shader, otherwise computing power will be sucked off…
Maybe if you have the particles already attracted to the path of the contour, try making the position which attracts the points change throughout the array of particle, therefore:
particle 0 will be attracted to contour point 0,
particle 1 will be attracted to contour point 1,
Then increase the attraction point every so and so - like half a second - , such as : the array becomes :
particle 0 will be attracted to contour point 0 + offset,
particle 1 will be attracted to contour point 1 + offset,
With offset being a number significantly big enough so the particules move enough from one point on the contour to an other.
// offset must be modulo length of the contour.
This second technic will use less computing power, which is good, but also you will end up with points passing outside your contour - going from the arm to the head for example-.
Hope this helps,