About this site

ScriptSpot is a diverse online community of artists and developers who come together to find and share scripts that empower their creativity with 3ds Max. Our users come from all parts of the world and work in everything from visual effects to gaming, architecture, students or hobbyists.

Particle script operators

Submitted by brttd on Thu, 2014-09-11 06:40

5
votes

Version:

1.0

Date Updated:

09/17/2014

Two script operators for pFlow.

Electric trails (script operator):
Particles move along the edges of a mesh, when they reach a vertex they choose a random edge to go along.
Second version added, which will choose only directions within an angle of a given vector.
A pFlow preset can be downloaded to get a fully working simple setup.
Since the script operator sets the speed of the particles, and detects when a particle is at a vertex, a small script is attached to get the best settings for a mesh.
If you want to change the settings, open up the script operator, and the two settings are at:
line 78 ( testResult = onPoint pCont.particlePosition database 0.5 ) (detection radius)
line 105 ( pCont.particleSpeed = newVector*0.01 ) (speed)

Spawn on edges (birth operator):
Particles spawn on the edges of a mesh, spaced equally based on a distance.
If you want to change the distance, open up the script operator and the distance is at line 15:pSpacing = 3.0

Additional Info:

Electric trails:
I recommend setting the particle integration step (pf source, System management, Integration step) to frame for both viewport and render. If it isn't, a particle can change course multiple times per frame.

Spawn on edges:
I'm new to script operators, so if you want to spawn the particles at a frame other then frame 0, you are going to have to change the code. Sorry.

Both scripts require an Editable_poly in the scene called "$Particle_surface" (Electric trails), and "$Particle_Spawn_Object" (Spawn on edges).
If there are any problems, please say, I have very little experience with using script operators so there are probably many faults with both.

Videos below show what electric trails does. Both are using a geosphere, the ones which leave the surface are because some of the edges are longer then others, which allows particles to jump past a vertex. The second video is the direction version, which only allows particles to go along edges within 90° of [0,1,0], which is why they group up.