BEGIN { particles = 2000 startSmoke = 0 x_origin = 0 y_origin = 0 z_origin = 0 x_length = 1 y_length = 1 z_length = 1 # initialise the random number generator srand() for ( i = 1; i <= particles; i++ ) { # define the object object = "object01" printf( " objectelement { \"eobject%d\" \"%s\"\n", i, object ) # generate the position x = x_origin + x_length * rand() y = y_origin + y_length * rand() z = z_origin + z_length * rand() # place the object in position printf( " loc { (%f %f %f) }\n", x, y, z ) # create a track printf( " controller { \"position\"\n" ) printf( " track {\n" ) # generate first frame position startFrame = startSmoke + int(144 * rand()) # start frame printf( " pointkey { %d (%f %f %f) (0 35.343 0) (0 -35.343 0) \"?\" }\n", startFrame, x, y, z ) # key frame 2 printf( " pointkey { %d (%f %f %f) (-1.6632 30.561 1.4553) (1.6632 -30.561 -1.4553) \"?\" }\n", 35+startFrame, x+10*(rand()-0.5), 70.686+y, z+10*(rand()-0.5)) # key frame 3 printf( " pointkey { %d (%f %f %f) (2.079 23.908 -2.9106) (-2.079 -23.908 2.9106) \"?\" }\n", 71+startFrame, x-6.6528+15*(rand()-0.5), y+122.25, 5.8212+z+15*(rand()-0.5)) # key frame 4 printf( " pointkey { %d (%f %f %f) (2.9106 23.493 -4.3659) (-2.9106 -23.493 4.3659) \"?\" }\n", 107+startFrame, x+8.316+20*(rand()-0.5), 166.32+y, -11.642+z+20*(rand()-0.5)) # end frame printf( " pointkey { %d (%f %f %f) (-1.6632 24.948 0) (1.6632 -24.948 0) \"?\" }\n", 143+startFrame, 4.9896+x+25*(rand()-0.5), 216.22+y, -11.642+z+25*(rand()-0.5)) # close the track printf( " }\n" ) # close the position controller printf( " }\n" ) # the visibility controller printf( " controller { \"visibility\"\n" ) printf( " track {\n" ) # initially invisible if (startFrame > 0) printf( " booleankey { 0 0 \"?\" }\n" ) # to avoid phantom-key problem if (startFrame > 98) printf( " booleankey { 98 0 \"?\" }\n" ) printf( " booleankey { %d 1 \"?\" }\n", startFrame ) # to avoid phantom-key problem printf( " booleankey { %d 1 \"?\" }\n", 98+startFrame ) # hide at end of life printf( " booleankey { %d 0 \"?\" }\n", 143+startFrame ) # close the track printf( " }\n" ) # close the visibility controller printf( " }\n" ) # close the object element printf( " }\n" ) } }