I’m trying to create fractal images with the following equation :
![alt text][1]
And it should look something like this (but in 3D) :
![alt text][2]
But I’m getting a very strange output. See the green particles are the 40 particles that are emitted. Even trying with 4000 or 400000 particles, it still forms a very similar shape:
[47235-screen-shot-2015-05-28-at-63703-pm.png*_|47235]
This is my code:
#pragma strict
function Start () {
var myParticleSystem : ParticleSystem;
var myParticles: ParticleSystem.Particle[];
myParticleSystem = GetComponent( ParticleSystem );
myParticleSystem.Emit(40);
var num_particles = myParticleSystem.particleCount;
myParticles = new ParticleSystem.Particle[num_particles+1];
var a = -55;
var b = -1 ;
var c = -42;
var x : float;
var y : float;
var z : float;
var particlePosition : Vector3;
for (var i = 0; i < num_particles; i++){ // Generalization of Barry Martin's original
particlePosition = myParticles*.position;*
_ x = Random.value * -1 ;_
_ y = Random.value * 10;_
-
// HERE I FOLLOW THE EQUATION EXACTLY HOW IT'S GIVEN*
//
_ var x1 = y- x / Mathf.Abs(x) * Mathf.Sqrt(Mathf.Abs(b * x + c));_
-
var y1 = a - x;*
-
var newposition = new Vector3(x1,y1,Random.value);*
-
myParticleSystem.GetParticles(myParticles); *
_ myParticles*.position = newposition;_
myParticleSystem.SetParticles(myParticles, num_particles);
_ }*_
}
[1]: http://1.bp.blogspot.com/-Lr2XmS3VayI/UsZlSBR5FNI/AAAAAAAAAwE/wPcAwLn4ypI/s1600/hopalong_eq.png
[2]: http://2.bp.blogspot.com/-JPRMjjdIMng/Ud1cTJuRA7I/AAAAAAAAAps/l53raY926yA/s1600/hopalong_orbit.png
_*