Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma strict
- public var colorToChange : Color;
- private var _particleSystem : ParticleSystem;
- private var _particles : ParticleSystem.Particle[];
- public function Start() : void
- {
- //_particleSystem = gameObject.GetComponent(ParticleSystem);
- _particles = new ParticleSystem.Particle[1000];
- }
- public function LateUpdate() : void
- {
- var count : int = particleSystem.GetParticles(_particles);
- print("---");
- print(_particles);
- print(count);
- print(particleSystem.particleCount);
- for (var i = 0; i < count; i++)
- {
- var hit : RaycastHit;
- if (Physics.Raycast (_particles[i].position, Vector3.forward, hit))
- {
- print("particle hit");
- _particles[i].color = colorToChange;
- }
- }
- particleSystem.SetParticles(_particles,count);
- }
Add Comment
Please, Sign In to add comment