- Home /
Question by
GarLeaf · May 30, 2013 at 01:34 PM ·
particlesystemparticlesimulate
I want to control my particleSystem with its own velocity.
in particle system(in unity 4.1), I find each particle can get own velocity
and each particle can collide on every game object.
so, Only one I want to do is, control each particle with my velocity...
each particles may be seeded at the its own position in Start function.
and new velocity of each particle is computed in every time step in the (fixed)Update function.
then, move with this velocity and collide with other objects...
so, I thought this can be done with particleSystem.simulate(float t) function..
but, this is so difficult. :<.....
this is my simple code...
how can I do this...........
using UnityEngine; using System.Collections;
public class PSTest : MonoBehaviour {
public int particle_num = 100;
private ParticleSystem.Particle[] points;
// Use this for initialization
void Start () {
points = new ParticleSystem.Particle[particle_num];
pp = new ParticleSystem.Particle[particle_num];
for(int i=0; i<100; i++) {
points[i].position = new Vector3(-10.0f+(20.0f/100.0f)*i, 3.0f, 0.0f);
points[i].color = Color.white;
points[i].size = 0.5f;
points[i].velocity = new Vector3(0.0f, -1.0f, 0.0f);
}
particleSystem.SetParticles(points, particle_num);
}
// Update is called once per frame
void Update () {
particleSystem.Simulate(0.001f);
}
}
Comment