You want to use part_info for that. and it depends on what you want to relate the rotation to... if you just relate it to age or position or ID, then it is easy, but if you want a different random rotation speed for each particle, that's more difficult. I only can think of using a table for that, but I am not so sure, if this would be fast... and then use a combination of ID and everytime when the age is 1 write new values. I attach a patch that does this, but I think you probably don't need to do it so complicated. marius.
PSPunch wrote:
Hi all,
Taking a break from audio processing for a while, I am lately appreciating playing around with GEM.
I was wondering if there is an object that can add random rotation to each particle, or whither this was possible at all. I am imagining that the program internally contains the location and vector of each particle. If there is no array tracking the rotation (and maybe a rotation vector) of each particle, perhaps this is not possible easily.
My initial goal is to render the particles as geos and have each rotate at different speeds.
Any ideas appreciated. Thanks.
-- David Shimamoto
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
#N canvas 597 62 611 571 10; #X msg 35 70 create; #X msg 60 90 destroy; #X obj 169 18 gemhead; #X obj 168 85 part_head; #X msg 88 116 1; #X msg 96 142 0; #X text 278 259 set the number per frame; #X text 333 280 set the age to kill at; #X msg 290 201 0 0.2 0 0.3; #X msg 377 200 0.2 0 0 0.3; #N canvas 87 154 247 179 Gem.init 0; #X msg 118 81 reset; #X obj 118 113 outlet; #X obj 118 48 t b b; #X obj 116 18 loadbang; #X connect 0 0 1 0; #X connect 2 1 0 0; #X connect 3 0 2 0; #X restore 66 194 pd Gem.init; #X obj 168 132 part_size 1; #X obj 168 254 part_source 5; #X obj 169 382 separator; #X obj 169 408 translate 1 0 0 0; #X obj 169 431 color; #X obj 169 471 scale; #X msg 278 518 draw line; #X msg 257 105 2; #X obj 170 502 rotateXYZ; #X text 375 400 this is rather velocity; #X text 379 416 than rotation; #X obj 279 498 loadbang; #X obj 170 537 square 0.2; #X msg 263 380 $1 $2 0; #X obj 169 56 rotateXYZ; #X obj 168 205 part_color; #X msg 200 180 1 0 0; #X msg 252 180 0 0 1; #X text 254 362 we don't allow particles spread along the z-axis; #X msg 257 76 1; #X obj 168 306 part_info; #X obj 29 443 tabwrite asdf; #X obj 53 468 tabread asdf; #X obj 29 416 random 360; #X obj 29 340 swap; #X obj 35 217 gemwin 50; #X obj 168 229 part_velocity sphere 0 0.1 0 0.1; #X obj 168 279 part_killold 100; #X obj 38 493 table asdf 500; #X obj 29 369 <= 1; #X obj 29 393 sel 1; #X connect 0 0 36 0; #X connect 1 0 36 0; #X connect 2 0 25 0; #X connect 3 0 11 0; #X connect 4 0 36 0; #X connect 5 0 36 0; #X connect 8 0 37 2; #X connect 9 0 37 2; #X connect 10 0 36 0; #X connect 11 0 26 0; #X connect 12 0 38 0; #X connect 13 0 14 0; #X connect 14 0 15 0; #X connect 15 0 16 0; #X connect 16 0 19 0; #X connect 17 0 23 0; #X connect 18 0 11 1; #X connect 19 0 23 0; #X connect 22 0 17 0; #X connect 24 0 14 2; #X connect 25 0 3 0; #X connect 26 0 37 0; #X connect 27 0 26 1; #X connect 28 0 26 2; #X connect 30 0 11 1; #X connect 31 0 13 0; #X connect 31 1 33 0; #X connect 31 1 35 0; #X connect 31 2 24 0; #X connect 31 3 15 1; #X connect 31 5 16 1; #X connect 31 6 35 1; #X connect 33 0 19 3; #X connect 34 0 32 0; #X connect 35 0 40 0; #X connect 35 1 32 1; #X connect 37 0 12 0; #X connect 38 0 31 0; #X connect 40 0 41 0; #X connect 41 0 34 0;