particleSystem Example : Attractors
The attractor force acts like a magnet, or gravitational body, drawing particles into orbit towards it.
/* particleSystem Example 5: Attractor */
light ()
particleSystem (
emitterVolume(point -5 5 5),
initialDirection(1 -.5 -.5 1 .5 .5),
speed (3),
rotation (-180 -180 -180 180 180 180),
size (.1 .3),
color(1 .3 0),
emitterRate(10),
lifespan(20),
attractorForce("attractor1" 5 5 5 50 1),
count(100)
)
|
/* particleSystem Example 6: Two Attractors */
light ()
particleSystem (
emitterVolume(point 0 5 0),
initialDirection(-.5 -.5 1 .5 .5 1),
speed (3),
rotation (-180 -180 -180 180 180 180),
size (.1 .3),
color(1 1 1),
texture ("wisp.rgb"),
emitterRate(10),
lifespan(20),
attractorForce("attractor1" -5 5 5 8 4),
attractorForce("attractor2" 5 5 5 8 4),
count(100)
)
|
/* particleSystem Example: Attractors,
one controlled by wand motion */
#include "User0"
light ()
environment(skyTopColor(1 1 1),skyBottomColor(0 0 0))
wandPosition(volume(infinite),
when(inside,
cube2.position($xpos 10 $zpos),
particles1.attractorforce("attractor2" $xpos 10 $zpos 40 10))
)
object(file(cube.pfb),position(-5 10 5))
object(file(cube.pfb),position(5 10 5))
object cube2 (file(cube.pfb),position(0 10 5))
particleSystem particles1 (
emitterVolume(box -5 5 0 5 15 10),
emitterRate(10),lifespan(100),
rotation(-15 -15 -15 15 15 15),
size(.5 1.5),
initialDirection(0 0 0 0 0 0),
color(1 1 0),
texture("wisp.rgb"),
friction(1),
count(200),
force("gravity" 0 0 -12),
attractorforce("attractor1" -5 10 4 100 5),
attractorforce("attractor2" 0 10 5 100 4),
attractorforce("attractor3" 5 10 6 100 5)
)
|
(c) Ben Chang