-
re: seedRandom(index,true)
I have used seedRandom(index,true); twice in this expression.
The first works exactly as I would expect it to.
The second seedRandom(index,true); applied to elasticity achieves undesirable results.
This bounce expression is applied to hundreds of ball graphics, instead of randomizing the elasticity across all of the balls it raises the elasticity from .89 to 1 from the left of the screen to the right.Screen Shot
https://img517.imageshack.us/img517/1050/notrandomsp8.jpgVy0 =200; //initial y velocity (pixels/second)
seedRandom(index,true);
Vx0 =random(-400,400); // initial x velocity (pixels/second)
g = 2500; // gravity (pixels/second/second)
floor = 1050;
seedRandom(index,true);
e = random(.89,1); //elasticityb = floor – position[1];
h = b + Vy0*Vy0/(2*g);
T = Vy0/g + Math.sqrt(2*h/g);if (time < T){ y = Vy0*time - g*time*time/2 + b; }else{ Vy = -(Vy0 - g*T); Vy *= e; t = time - T; y = Vy*t - g*t*t/2; } [position[0] + Vx0*time, floor - y] What have I done now? Any help is very much appreciated! David