So is there any way to create particle form like this?
Thanks!
[13818-без+имени-2-восстановлено.png|13818]
I’ve done very little scripting with Particles (beyond turning them on an off), so this was an interesting question for me. Here is a script that uses a Mathf.Sin() to create a wave as you’ve outlined.
var magnitude = 1.0;
var period = 2.0;
var maxParticles = 1000;
private var particles : ParticleSystem.Particle[];
private var ps : ParticleSystem;
function Start () {
ps = particleSystem;
particles = new ParticleSystem.Particle[maxParticles];
}
function Update() {
if (ps.particleCount > particles.Length) {
particles = new ParticleSystem.Particle[ ps.particleCount];
}
ps.GetParticles(particles);
for(var i = 0; i < ps.particleCount; i++) {
var dist = particles*.position.x - transform.position.x;*
particles_.position.y = Mathf.Sin((dist % period) / period * 2.0 * Mathf.PI) * magnitude;_
* }*
* ps.SetParticles(particles, ps.particleCount);*
}
[13837-particlesine.jpg|13837]_
Apparently you cannot get the maximum number of particles in script, so I use a variable plus some code that will resize the array if the variable is wrong.
_