# Can I apply a force to particles from a script?

I'm working on a game which involves streams of electrically-charged particles, being manipulated with electric and magnetic fields. Since I want a large number of small objects coming from an emitter and lasting a limited amount of time, a particle system seems like the way to go.

My only problem now is: how to apply the force? Suppose, for example, I have a charged object somewhere in the scene; I want to apply a force toward it, varying with the radius squared. If my particles were Rigidbodies, applying this force in the FixedUpdate would be easy; is there a way to do the same to an individual particle?

• Since you can add RigidBody to the particle system, im second guessing myself. There's a chance you could turn that on, and have your charge areas as triggers, and apply the force from the charged object through the trigger event. If that's viable, ill update my answer below. – Stephan Nov 7 '18 at 16:14
• @Stephan If that works, that would be perfect. – Draconis Nov 7 '18 at 16:16

You will probably have luck by using the ShapeModule with a ShapeType of Mesh and MeshShapeType of Edge. You could then have the player manipulate the vertex positions of the mesh to create the field line along which the particle will travel.
If you're comfortable with using beta builds of Unity, the 2018.3b version introduces a new GameObject Component called ParticleSystemForceField. This allows you to define custom areas of forces to be applied to particle that enter the area.