How to set particle direction from C# script

Can anyone point me to clues on setting the direction of particle emission always away from the origin. So far I have
obj.GetComponent().relativeForce = obj.transform.position;
but I think that is applying a force to the object as a whole and not to the particles

If you attach a default particle system, it emits in a cone away from its center, going along the Z axis.

If you want it to spray in a different direction, set the rotation of the gameObject so that the Z axis is pointing somewhere else.

It can sometimes be helpful to make your particle system objects consist of a root gameObject that you do not rotate, with a child gameObject that actually contains the ParticleSystem, and then you only aim the child around the way you want it.

If it makes you feel better, you’re not alone in being stymied trying to access the particle system in code. Currently, it has very limited/clunky script access. Thankfully, this is (finally) on the roadmap to be addressed in 5.3 this December.

Thanks Kurt, I was able to follow your advice and get it working.