[Shuriken] Direct particles to a point

Hi all,

I’m trying to use a particle system to create some kind of “collect” effect inside the game. When the player collects an item, I want to emit several particles, which keep flying around the place I collected the item, and after a while, they go flying to the center of the box in the inventory.

More or less I know how to stop them after a few seconds, but I don’t know how to thrown them to the inventory later.

Thanks!

It’s possible (but laborious) to take direct control of the ParticleSystem’s particles:

public class ImplodingEmitter : MonoBehaviour {
	void Start() {
		StartCoroutine(Implode());
	}
	
	IEnumerator Implode() {
		if (!particleSystem.isPlaying) {
			particleSystem.Play();
		}
		
		//let the system do it's thing for a bit
		yield return new WaitForSeconds(3f);
		
		//stop emission
		particleSystem.emissionRate = 0f;
		
		//allocate reference array
		ParticleSystem.Particle[] particles = new ParticleSystem.Particle[particleSystem.particleCount];
		
		
		//this loop executes over several frames
		// - get particle list
		// - update each particle's position
		// - set particle list
		// - wait one frame
		for (float t = 0f; t < 1f; t += 0.1f) {
			int count = particleSystem.GetParticles(particles);
			for (int i=0; i<count; i++) {
				particles_.position = Vector3.Lerp(particles*.position, transform.position, t);*_

* }*
* particleSystem.SetParticles(particles, count);*

* yield return null;*
* }*

* //once loop is finished, clear particles*
* particleSystem.Clear();*
* }*
}
Other option, and honestly it might be easier, is to just create your own GameObjects and move those. Each GameObject could have an emitter attached (say, a single particle set to simulation space “local”), or could just be a quad that happens to look an awful lot like a particle.