Thursday, June 19, 2008

brownian motion

A small script to simulate brownian motion in 3dstudio max. The script has to be placed in a script operator for the particles.


--
-----------------------------------------------------------------------------------
--\\\\\\\\_________________________BROWNIAN MOTION_________________________////////
--//////// \\\\\\\\
-----------------------------------------------------------------------------------
--> Written by dimitris gourdoukis.
--> object-e architecture 2007.
-----------------------------------------------------------------------------------
--> http://object-e.blogspot.com/
--> object.e.architecture@gmail.com
-----------------------------------------------------------------------------------
--> Last Modified 9/14/07.
--> Use and modify at your own risk.
-----------------------------------------------------------------------------------
--> Description:
-- This is a simple script to simulate brownian motion with particles. Paste
-- the script in a script operator in the particle view.
-----------------------------------------------------------------------------------


on ChannelsUsed pCont do (
pCont.useSpeed = true --enable the Float channel
)

on Init pCont do (
)

on Proceed pCont do(

--Get the number of particles
count = pCont.NumParticles()
--create a for loop for the number of particles
for i in 1 to count do (

--set the particle index to i
pCont.particleIndex = i
--give a random speed to the particles
pCont.particleSpeed = (random [-0.2,-0.2,-0.2] [0.2,0.2,0.2])

)
)
on Release pCont do (
)

No comments: