Trying to animate particles via script, troubling result


I’m messing around with particles, and I’ve bumped into a result I don’t understand.

What I’m trying to do is making all particles emitted by a specific gameobject drift/move toward another gameobject. My target point is a public variable I set up manually, and I’m using the Lerp vector3 method to change the position of my particles.

This is the code of my whole class:

using UnityEngine;
using System.Collections;

public class goToward : MonoBehaviour {

	public GameObject m_Destination;
	private ParticleSystem.Particle[] m_Particles= new ParticleSystem.Particle[5000];

	void Start () {


	void Update () {
		int particleLength = particleSystem.GetParticles (m_Particles);;
		for (int i=0; i<particleLength;i++) {

* }*
* particleSystem.SetParticles (m_Particles,particleLength);
So, what I have trouble understanding is this: with this code, all particles emitted by the gameobject actually stop halfway from the target gameobject. Here is a skillfully edited screenshot showcasing my problem:
(edit: well derp, text is too small to be read, but the attached image is the correct size!)
Is there some subtelty with either Lerp or ParticleSystem I’m missing that create this result?

Your simulation space is Local, so the particles position is in the local coordinate system.

Depending on how you want your system to behave, either change the particle system to simulate in World space, or transform the position of that target into local space with InverseTransformPoint like this:

m_Particles<em>.position = Vector3.Lerp(m_Particles*.position, transform.InverseTransformPoint(m_Destination.transform.position), 0.1f);*</em>