- Home /
particles local to world, I am noob with a problem
So This has been asked before but I did not quite understand the answers.
The link is: http://answers.unity3d.com/questions/352554/particle-system-change-the-velocity-by-script.html
I think I am doing it wrong:
As I am following this as a test to see if it works:
void LateUpdate () {
ParticleSystem.Particle[] p = new ParticleSystem.Particle[particleSystem.particleCount+1];
int l = particleSystem.GetParticles(p);
int i = 0;
while (i < l) {
p[i].velocity = new Vector3(0, p[i].lifetime / p[i].startLifetime * 10F, 0);
i++;
}
particleSystem.SetParticles(p, l);
}
I tried this to see if it would work.
Is this too difficult for me? As I understand the scripting and can read it just about, and understand the logic, but I am getting this error.
I am trying to create a lava drop to fall off a lava tail, but when it moves the drops just hang in mid air then they fall, and I am trying to get it to form on the tail and then fall behind the tail naturally.
Just not sure how else to solve this problem unless i am missing an obvious function in the particle editor that allows you to do this.
I am not very well versed in the noble art of program$$anonymous$$g in C# but I think the line "public class NewBehaviourScript : $$anonymous$$onoBehaviour" is the one messing with you. Try switching "NewBehaviourScript" with the script name, "particleSwitch_Local_World".