Hello,
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++) {
m_Particles<em>.position=Vector3.Lerp(m_Particles*.position,m_Destination.transform.position,0.1f);*</em>
* }*
* 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:
_[19037-bug.png*|19037]*
(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?
_*