void LateUpdate () 
		{
		
			int particleCount = myParticleSystem.GetParticles(particleArray);
		
			for (i = 0; i<particleCount ; i++)
			{
				particleStartLifetime 	= particleArray[i].startLifetime;
				particleCurrentLifetime 	= particleArray[i].lifetime;

				if (particleStartLifetime - particleCurrentLifetime <= Time.deltaTime)
				{
					particlesInitialPositions[i] = particleArray[i].position; //Record Initial position
				}
				
				normalizedLife = 1 - particleCurrentLifetime/particleStartLifetime;
				particleData = splineController.GetPositionByLife(normalizedLife,GetComponent<ParticleSystem>().simulationSpace);

				if (updateSpeed)
					particleArray[i].velocity = particleData.speed;

				particleArray[i].position =particleData .position +particlesInitialPositions[i];

			}
		
		myParticleSystem.SetParticles(particleArray,particleCount); 
		
		}
Ejemplo n.º 2
0
        void LateUpdate()
        {
            int particleCount = myParticleSystem.GetParticles(particleArray);

            for (i = 0; i < particleCount; i++)
            {
                particleStartLifetime   = particleArray[i].startLifetime;
                particleCurrentLifetime = particleArray[i].remainingLifetime;

                if (particleStartLifetime - particleCurrentLifetime <= Time.deltaTime)
                {
                    particlesInitialPositions[i] = particleArray[i].position;                     //Record Initial position
                }

                normalizedLife = 1 - particleCurrentLifetime / particleStartLifetime;
                particleData   = splineController.GetPositionByLife(normalizedLife, GetComponent <ParticleSystem>().simulationSpace);

                if (updateSpeed)
                {
                    particleArray[i].velocity = particleData.speed;
                }

                particleArray[i].position = particleData.position + particlesInitialPositions[i];
            }

            myParticleSystem.SetParticles(particleArray, particleCount);
        }