# Magnetic effect?

Hey
I’m trying to suck up stuff (particles) with a hoover and for this to work I’m looking for some kind of magnetic effect. So only particles close to the hoover’s nozzle should get sucked in (force). Any idea on how to implement that?

I was using the Conform By Sphere, but that affects all particles and the effect cannot be limited to a certain area it seems…

You can use a Particle System Force Field, which has gravity, but I can’t think of a generic way to have the “hoovered” particles die when they reach the center.

1 Like

I can throw some hint, but it requires bunch of nodes. I don’t know your requirements, so I am gonna give you example how you can tackle the problem. Also, I assume you need to kill particles when close to hoover and you want some kind of directionality.

You need to write custom node (operators) that manipulates velocity of particles in given area, plus kill them when close enough.

1. First declare some transform, it will give us position and direction of hoover (end of pipe) - I will call it “succ point”
2. Find relative position from succ point to particle (particlePosition - succPoint)
3. Calculate squared magnitude of this vector (squared is faster, but it can be magnitude as we probably need it later anyway) - this is distance between particle and succ point.
4. Check if distance is smaller than the range you want. When in range, you should apply some force towards succ point like this `normalizedParticleDirection * -1 * force`. You might want the force to be greater when close, if that is the case you can do some `force = lerp(minForce, maxForce, distance/maxdistance)`.
5. At this point you should have sphere that attracts particles around succ point, but you can add some simple directionality similar to cone. To do this you need to also check if dot product between succpoint forward vector and normalizedParticleDirection is greater than some number between 0-1. You can calculate exact angle using cosine.
6. Now you attract particles only from one direction, but you probably need to kill particles when they are close to pipe, in this case just check short distance from succ point and if it’s smaller than some range you set particle `alive = false` or greatly increase particle age, so it dies in several frames.
1 Like

Thanks for the input! I wasn’t aware of custom nodes etc, but I spent some time on it and I got something working. Not exctly your approach, but it’s similar I think. Anyway: