Is it possible to add items in the right click menu, in MAXScript?
I would love to be able to customize the menus.
Thanks
Ruben
I need to script (outside of Pflow) applying Particle Skinner to a lot of different objects. However, I ran into an issue where I cannot assign a Pflow source to the modifier until after one has been added manually (which kind of defeats the purpose for me). Has anyone found a way around this? I have ran into issues in the past where I have had to force assign a controller to a max parameter when no keys are present to sort of initialize it. Could this be a similar issue? Anyway, any help would be great.
Thanks
Charley
Hi,
How do i apply materials to particles via scripting?
Thanks
Hello,
Can somebody show me examples on how to spawn particles via pflow scripting?
Thank you
Hi,
I am making the particles move along some vector positions on a spline. Here my vector positions are the knots on the spline. Bascially what it does is just keep it rotating around the spline through all the vector positions assigned.
The problem here is, the particles take up the first vector position exactly the way i want it, but doesn't take up the next vector position, instead goes out from the way it is supposed to be.
Particles start moving to its first vector positions from frame 5 and reaches the assigned positions on frame 10 as the find target operator is set to be controlled by time, but after that it is supposed to take the next vector position [which is the next knot point on the spline] which is not happening.
Please have a look into the max file attached and advise me.
Thank you
Hi all,
I am trying to figure out something for the past 3 days. Very much new to particle flow scripting.
In the scene i have a circular spline with 12 knots on it. I am trying to put a particle on each knot on the spline. As all the knots on the spline have the same normals, i put a plane object on each knot point and oriented it the wat i wanted it. Now i want the normals of each plane object that is on the knot point to be reflected on my particles. That means the particles should face the way the planes face.
I tried copying the plane's transform to the particle's transform but unfortunately it resizes the particles which i dont want.
Please help me with this obstacle i am facing.
Thanks to all
I am trying to orientate the particles to the faces orientation and also enable the particles vector channel to the face center. In the below code everything works perfectly except the particles gets resized when it reaches its assigned position.
[quote]
on Proceed pCont do
(
count = pCont.NumParticles()
theWall = $backWall
theFaceIndex = 1
for i in 1 to count do
(
pCont.particleID = i
theTM = matrixFromNormal (polyOp.getFaceNormal theWall theFaceIndex)
theTM.row4 = polyOp.getFaceCenter theWall theFaceIndex
pCont.particleVector = theTM.row4
append theParticleMatrix theTM
theFaceIndex += 3
)
)
[/quote]
How to retain the particle size even after it reaches its assigned vector position?
Please adivise
Thank you
Hi ,
1. I am wondering if there is any way to enable indenting and color coding in the particle flow script editor like we have in the maxscript editor.
2. Where do we install the downloaded Orbax freebies in windows 7 64bit 2012 3ds Max?
Thankyou all for checking.
How to change the shape of a particle from 2D to 3D via scripting? And also checking whether it is possible to go deep into the settings inside the 2D or 3D option.
Thanks for looking at this post.
Can someone explain why a script operator with
[code:1]on ChannelsUsed pCont do
(
pCont.useAge = true
pCont.usePosition = true
)
on Init pCont do ()
on Proceed pCont do
(
count = pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
pCont.particlePosition += [0,0,sin(10)]
)
)
on Release pCont do ()[/code:1] evalutes fine, but
[code:1]on ChannelsUsed pCont do
(
pCont.useAge = true
pCont.usePosition = true
)
on Init pCont do ()
on Proceed pCont do
(
count = pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
pCont.particlePosition += [0,0, sin(pCont.particleAge)]
)
)
on Release pCont do
()[/code:1] throws errors?
So do not delete, only make hidden for rendering. If a particle is returned, it again becomes visible.
The area is defined by Mesh, or Box, or simply Plane that separates space.
Thank you.
Hello! I've ran into a problem with a scene I'm currently working on. Right off the bat I'd like to say - I am absolutely new to scripting, so I'm sure there's a lot of issues with the script.
It's a traffic light system that uses a deflector to stop or pass traffic through. The deflector is tied to a PFlow and is controlled with a script - when the light switches to green - the deflector moves away and traffic moves through, when the light turns red the deflector is placed back and the traffic is blocked.
Here's a screenshot of the setup with a script for the green light visible.
[img]http://farm6.static.flickr.com/5026/5804333028_fdd07119c5_b.jpg[/img]
I am combining all of my deflectors into an array, then when the script is executed on the green light they are moved to a 0,0,-50 position. When a red light event is triggered, a similar script moves the deflectors to a 0,0,0 position.
What's happening now is - the deflectors move to a proper spot when the green light is activated, but only stay at that spot for one frame, after which they move back to 0,0,0. Would anybody know why this is happening and how it could be fixed?
The script for green light works fine if I turn the script for the red light off. So basically they seem to be conflicting with each other.
Thank you very much!
Anton.
Hi!
I have a script operator that scale my particles in relation to their distance to my camera.
The script is very simple (based on Bobo's Multires-script):
[code:1]on ChannelsUsed pCont do
(
pCont.useScale = true
pCont.usePosition = true
)
on Init pCont do
(
)
on Proceed pCont do
(
local count = pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
pCont.particleScale = (length (pCont.particlePosition - $cam_1_render.pos))/23000
)
)
on Release pCont do
(
)
[/code:1]
In the viewport everything is correct but when I render the operator is ignored.
I previously tried to do the same thing with box#3 but I couldn't get the data operator to change the scale at all (I am a beginner with box#3...).
Any hints on how to get my scale thing working?
regards
Hi All,
I have a pretty simple script at the moment. It selects my PhsyxWorld object and clones it, takes the clone and assigns it into the current Phsyx World Operator. This should happen once on every frame the system is calculated. But whats happening is after the script sets the new/copied phsyx world driver, pflow updates causing the script to run again, this causes a infinite LOOP. :) Any ideas on how to stop it from happening? Thanks -Nick
on Init pCont do
(
)
on Proceed pCont do
(
(
select $'PhysX World 00'
maxops.clonenodes $ actualNodeList:&c newNodes:&d
select d
$'PhysX World 01'.PhysX_World_Driver = $
)
)
on Release pCont do
(
)
I'm searching for the right way of creation a for me complex particle animation. For professionals certainly already earlier done. Although it is a private project I can unfortunately of causes of secrecy only sketch my project.:
All in all it's a transition/ dispersion of one great object to many little objects. The special thing is both the one great object an the many litlle objects ar animated. Last ones are animated shapes. I want to do this actually by fragmenting the one great object and then morph into the little objects. Because it seems to me to consuming or unimpossible to use really morhing techniques made for facial animation I want to use a morphing via particles. The particles should travel from the shape of a fragment to the shape of a little object in the same (animated) position like the fragment. With geometry I would do this with a Find Target Operator. So - although a would prefer to did my particle animation using the shapes of particles (read in shape of the static fragments/ instanced shape of my little objects) I will ask you here about the geometry method.:
when I have to animate thousends of fragments should I create thousends of PFlow systems referring to thousends of emitter meshes and thousends of target meshes via MaxScript? Or can I do this with one or more Script Tests/ a BirthScript in one single PFlow System? Please take into account that all fragments will be animated and morphed into the little objects during about a minute or longer and not at one time.
Hello everyone.
How to get shape operator, "size" value?
Because particleScale give me output of 1 (if not any scaling was modified)
Thanks.
I need help. :P
I have two emitters.
In the second PFSource particles are targets.
Particles from the first emitter must go to them.
In two PFSource particles are emitted in the 0 frame.
Targets are activated by the Deflector.
At the beginning I made it through ParticleIDs but after going to the next event ID change.
I read here that this can be done using particleInteger but I can not refer to another PFSource particleInteger.
How do I do?
Why even do pCont.particleID = pCont.particleInteger it does not work.
In the Max listner after using print pCont.particleID I see good value. in the viewport I see wrong values.
sorry, my English is poor.
[url=http://postimage.org/image/2iue6v8ec/][img]http://s3.postimage.org/IKzQr.jpg[/img][/url]
I'll give you the answer first, that I expect to get....
NO
The question
The object ID (gbufferchannel) can not be set on a particle by particle basis?
Hi,
Is it possible to get a particle's material and material ID using maxscript? I only found the methods to set those.
Thanks,
o
I have a simple IK spline controlled by a force in PF
(see file)
The PF controls the spine IK as expected in the viewport
but will not render out with the same motion.
My integration steps are 1/8 of a frame.
Here is the script
[i]on ChannelsUsed pCont do
(
pCont.usePosition=true
)
on Init pCont do
(
global GADGET=$point*
)
on Proceed pCont do
(
t = pCont.getTimeEnd()
count = pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
x=pcont.particleID
GADGET[x].position = pCont.getParticlepositionByID x
)
)
on Release pCont do
(
)[/i]
Am I missing a line in code to get this to Render out?
Is it possible to assign the ".setParticleMapping pID Int Point3" to a user defined variable that is accessible via Script operator?
Sure not finding a solution :(
I can see the Channel data via box3 and Krakatoa, but I can't seem to be able to assign it to anything so I can use the point3 data via script.
Hello world,
I'm a 3ds MAX newbie and haven't work much with particles and scripting yet.
- I'm looking for a way to randomly pile up particles and let them randomly break off the pile at the same time.
- The only way the particles can attach to the pile is on the top and the bottom of the pile.
- And I like to animate the entire pile too.
Thanks in advance,
Nino
Ignore me, I should have done a search first :)
Cheers,
Paul
Hi,
I have a scene using box2 with 34 events, some with multiple particles that will be baked to multiple meshes and others with multple particles glued together that will drive a single custom mesh. I'm trying to bake out the particle positions to the custom geometry via a script. The problem I'm getting is the moment I set the particleIndex property, it takes an age to update. Taking the line "pFlowNode.particleIndex = p" out of the script makes the scene update run fine. The simulation has been cached/baked to improve the speed. Does anyone have any ideas?
Here's the code...
[code:1]fn bakeToMeshes =
(
local pFlowNode = $'PF Source 01'
local gate_supportArray = $gate_support_f*
local wall_rightArray = $wall_right_f*
local wall_leftArray = $wall_left_f*
local firstFrame = animationRange.start.frame
local lastFrame = animationRange.end.frame
local count = pFlowNode.numParticles()
progressStart "Baking Particles..."
local cnt = 0
local numFrames = lastFrame - firstFrame + 1
for t = firstFrame to lastFrame do
(
cnt += 1
if not (progressUpdate (100.0 * cnt / numFrames)) do exit
sliderTime = t
for p = 1 to count do
(
pFlowNode.particleIndex = p
)
)
progressEnd()
)
bakeToMeshes()[/code:1]
Cheers,
Paul
Script to update a object position.
Its being used as a script test but in the code below I just posted a operator script test for visual feedback
The issue I'm having is that at render time the distance calculation does not get updated. It will update if you manually click ahead on the time slider. But this number will not update at render time. If anyone can give me some help I would really appreciate it.
Steps to reproduce:
- Create a basic particle system with a script operator
- Create two objects Point01 and Point02
- Animate those two object doing any kinda of XYZ movement
- Open Particle Flow
- Open your max script listener
- Scrub the timeline and watch the output number change
- Number should update the distance between objects
-----
- Now with your listener open render a few frames (can be blank frame/no output)
- Output number do not change!
[quote]
on ChannelsUsed pCont do
(
pCont.useTime = true
pCont.useSpeed = true
pCont.usePosition = true
)
on Init pCont do
(
)
on Proceed pCont do
(
Print (distance (at time currenttime $Point01.pos) (at time currenttime $Point02.pos)) -- $Point01.pos and $Point02.pos are objects
)
on Release pCont do
(
)
[/quote]
Thank in advance, this problem is killing me.
Hello, I wonder if it is possible write a macroscript for the "PFlow", which reads the positions and the orientations of the particles from "txt" file, creates them and then moves them at each frame?
And the amount of frames and particles is indeterminable.
For example:
FRAME1:
Particle1.position[X:0.0 Y:[b]0.0[/b]] Particle1.rotation[Z:[b]90[/b]]
Particle2.position[X:2.5 Y:[b]0.0[/b]] Particle2.rotation[Z:[b]90[/b]]
Particle3.position[X:5.0 Y:[b]0.0[/b]] Particle3.rotation[Z:[b]90[/b]]
Particle4.position....
FRAME2:
Particle1.position[X:0.0 Y:[b]2.0[/b]] Particle1.rotation[Z:[b]95[/b]]
Particle2.position[X:2.5 Y:[b]2.0[/b]] Particle2.rotation[Z:[b]95[/b]]
Particle3.position[X:5.0 Y:[b]2.0[/b]] Particle3.rotation[Z:[b]95[/b]]
Particle4.position....
FRAME3:
Particle1.position[X:0.0 Y:[b]4.0[/b]] Particle1.rotation[Z:[b]100[/b]]
Particle2.position[X:2.5 Y:[b]4.0[/b]] Particle2.rotation[Z:[b]100[/b]]
Particle3.position[X:5.0 Y:[b]4.0[/b]] Particle3.rotation[Z:[b]100[/b]]
Particle4.position....
FRAME4:
Particle1.position[X:0.0 Y:[b]6.0[/b]] Particle1.rotation[Z:[b]105[/b]]
Particle2.position[X:2.5 Y:[b]6.0[/b]] Particle2.rotation[Z:[b]105[/b]]
Particle3.position[X:5.0 Y:[b]6.0[/b]] Particle3.rotation[Z:[b]105[/b]]
Particle4.position....
FRAME5:
Particle1.position.....
[img]http://www.vitsly.ru/bokeh/Bokeh.jpg[/img]
Tutorial in my blog.
[url]http://vitsly.wordpress.com/2009/12/15/bokeh-in-3dsmax-with-particle-flow-and-maxscript/[/url]
Hi there,
I'm wondering if anyone can help me. I'm using the birth script from Oleg Bayborodin so that I have particles where vertices are on a mesh. This is a fantastic script that I enjoy using, however there is a problem...
this time I need the mesh to be animated, but of course the particles don't want to follow the mesh, they just stay static (the mesh displaces up and down over time using a displacement map). I want the particles to be 'sticky' like with 'lock on emmitter' and 'animated shape' with the position object op.
Does anyone know what I can do to this script to make it 'sticky'?
here is the script:
[i]on ChannelsUsed pCont do
(
pCont.useposition = true
)
on Init pCont do
(
global pflowguide = $[b]emmitterobjectname[/b]
)
on Proceed pCont do
(
if pflowguide != undefined do
(
t = pCont.getTimeStart() as float
NumVerts = getNumVerts pflowguide
if t < 0 do
(
for i = 1 to NumVerts do
(
pCont.AddParticle()
pCont.particleIndex = pCont.NumParticles()
pCont.particleposition = polyop.getVert pflowguide i
)
)
)
)
on Release pCont do ()[/i]
and then I later use this script to call up the position again:
on ChannelsUsed pCont do
(
pCont.useVector = true
pCont.usePosition = true
)
on Init pCont do
(
)
on Proceed pCont do
(
count = pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
pCont.particleVector = pCont.ParticlePosition;
)
)
on Release pCont do
(
)
thanks in advance,
Oli.
Hi,
I was modifying your example, because it was not completely how i need it to work. I need to make a stack of particles and they need to form a spiral (or twist) rotation in it (helix). Instead of the sphere i used a plane (with much segments and a twist, and converted to a editable mesh) and i only used the 'even' numbered verticles.
But i get a problem with the rotation, as you can see in the following screenshot.
[img]http://www.vondutchguild.com/cypress/rotationproblem.jpg[/img]
They seem to 'flip' each 90 degrees. You guys maybe know what the problem is?
Greets,
Cypress.
Sourcefile: http://www.orbaz.com/forum/download.php?id=763
Hi,
I have a nice pFlow system (with some custom scripting), and almost everything works. Only i have a problem with the movement and rotations of a portion of my particles in the system.
In the begin al particles just random bounce in a box (uDeflector), but randomly some particles will do a 'Find target' to some mesh objects (who are linked to my main mesh object) in the scene. When the particles reach this object i stop there 'Speed' and 'Spin'. My problem is the rotation and movement i wanna give them on this point.
I want all the particles to keep 'following' there target. But since the particles allready reached there target and are in a new event i wanna script the movement of those particles. I want to keep there offset they had from when they entered the event.
But i dont know how.. this is what i was trying:
[code:1]on ChannelsUsed pCont do
(
pCont.useTM = true
pCont.usePosition = true
pCont.useMatrix = true
)
on Proceed pCont do
(
backTM = $Box01.transform
count = pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
if (pCont.particleNew) do
(
pCont.particleMatrix = pCont.particleTM - backTM
)
pCont.particleTM = pCont.particleMatrix + backTM
)
)[/code:1]
I think my problem is easy, but i don't know the math to do stuff like that. I just want all the particles in that event to 'attach' to the box. And keep there offset from the box they had when they entered the event.
Greetz,
Cypress.
Trying to control an if statement with the particle material index. The .useMtlIndex is present but I see no channel usage ie> pCont.particleMtlIndex
Does this channel call exist?
if not, what is the proper syntax to call this channel?
or
Does it just exist to Set the material index.
if so, why isn't there a Get function?
Best regards,
John
I know a few people were interested in my script's updates so thought id announce it!
Modifier Modifier Zorb is updated to v2.5.6!!
Updated to v2.5.6: Added Loading and Saving of all modifiers, objects, materials
etc properties. Added an update button for the properties dialog
Also world units should show up properly now.. i think!! I also added an auto update functino thats seems to work some of the time, but you have to be editing the first node that the script find. (There is a button to select it if you want too!)
XML loading and saving adds the ability to manage presets for everything now!! Doest supportevery type of property, eg some material settings may not get saved. Let me know if you find anything you need s0looking at and I can fix it
Get it here:
http://www.scriptspot.com/3ds-max/modifier-modifier-zorb
A sample of using the Find Target and Go To Rotation Op. The Find Target Vector and Orientation are defined by the Script Op.
-----------------------------------------------------------------------------------
I ran into a problem using the particleOrientation property, so I used the particleTM instead.
1. I extracted the rotation part of the stored target rotation matrix..
2. converted the rotation from a quat to an eulerAngle
3. then formed a float triplet like this [rot.x, rot.y, rot.z]
4. lastly I assigned that value to the particleOientation property.
The result was quite jumbled, although it showed some clues that the orientations are looking correct, it just wasn't assigned to the proper particle. The problem was getting it to assign correctly.. I tried assigning them by Index and by ID to no avail. So in the end, it was a good thing that the particleTM worked.
-----------------------------------------------------------------------------------
Another weird thing I ran into, in the Find Target Op, using the Surface Normals as Docking Direction, the option does not seem to follow the surface normals of the target mesh correctly... I will have to do further tests on this though....
[size=15][b]PF Spliner v4.0 - [url=http://www.orbaz.com/forum/download.php?id=1311]Download[/url] (Save Target As..)[/b]
[/size]
[i]PF Spliner v3.5 [url=http://www.orbaz.com/forum/files/pfspliner_v351_189.zip]Download[/url] (Save Target As..)[/i]
*** 3.5 Has the Spline Per System functionality
*** 4.0 Has TP Support
*** Will soon try to merge both of these versions...
[b]4.0.0[/b] - [i]By JohnnyRandom - 2011-11-07[/i]
[list][*]Added complete support PFlow or Thinking Particles
[*]Fixed the Animated Growth feature to work with the increments & Time Duration.
The system now take the Increments value into account.
[*]Changed you can now use all options when you Generate Splines.
Previously you could not get proper Animated Growth animation. Only the
first spline created would be animated.[/list:u]
[b]3.5[/b] - [i]By Ofer Zelichover - 2010-10-11[/i]
[list][*]Added Spline Per System.
[*]Done some code re-organization.[/list:u]
[b]3.4.2[/b] - [i]By JBond - 2011-11-06[/i]
[list][*]started TP support[/list:u]
[b]3.4.1[/b] - [i]By JohnnyRandom - 2010-01-02[/i]
[list][*]fixed bitmap pointer in 'invertMaskBitmap' function to point to valid Icon (it seems the original was removed in ver2010)[/list:u]
[b]3.4[/b] - [i]2009-06-29[/i]
[list][*]added animated growth checkbox/button
[*]added credits to jbhaywood for the animated splines part
[*]added progress bars (splining and animated growth)
[*]added select button for generated splines
[*]added ESC for animated growth
[*]added tooltips[/list:u]
[b]3.3[/b] - [i]2009-05-09[/i]
[list][*]added ESC button press for spline generation[/list:u]
[b]3.2[/b] - [i]2008-10-08[/i]
[list][*](I can't remember what I did with it hehe, probably fixed something)[/list:u]
[b]3.1[/b] - [i]2006-07-09[/i]
[list][*][url=http://www.orbaz.com/forum/viewtopic.php?p=3548#3548]JBHaywood added the animated spline growth[/url][/list:u]
[b]3.0[/b] - [i]2006-03-29[/i]
[list][*][url=http://www.orbaz.com/forum/viewtopic.php?p=2705#2705]modified/updated the script[/url]
[*]fixed birth/deletion over time
[*]added creation threshold parameter
[*]updated UI
[*]auto PF detection[/list:u]
[b]2.0[/b] - [i]2006-01-28[/i]
[list][*][url=http://www.orbaz.com/forum/viewtopic.php?p=2350#2350]Charley added UI[/url][/list:u]
[b]1.1[/b] - [i]2005-12-23[/i]
[list][*][url=http://www.orbaz.com/forum/viewtopic.php?p=2254#2254]Charley fixed some errors[/url][/list:u]
[b]1.0[/b] - [i]2005-07-16[/i]
[list][*][url=http://www.orbaz.com/forum/viewtopic.php?p=1297#1297]Charley posted the bare script code[/url][/list:u]
hi guys,
When i create my script op, i've to go to the PF View and move it, otherwise it's not working.
first i tried with ev.apprendAction myop
then with ev.insertAction myop
i've still the same problem
[code:1]
ParticleFlow.endEdit()
Ev.insertAction % 1
ev.setComments % \"Please DO NOT Rename this Operator\"[/code:1]
http://aespid.com/Perso/MS/PF_MS_01/PF_MS_01.html
second problem, when my particles are deleted or if i running the animation back, the lights are not moving back to [-10000,-10000,-10000].
I asked one of my friend to run my script, and on his workstation, the lights are moving back.
We're both using max 2009 x64. :roll:
Hi
I'm trying to push particles round into various positions. The particles are created with XYZ data from a text file. I store their original positions in the vector channel since I want to return the particles to their original positions at the end. The trouble is, I'd like to position them using a grayscale bitmap halfway throught the animation. I expect i could do this using PositionObject, the vector channel and FindTarget, but I'm already using vector. Is there any way around this?
Thanks
Mark
Hi
I have a scripted PFlow system that positions each particle according to data read from a text file. I'm doing various things that move these particles around, but at the end of it all I'd like for them to make their way back to their original positions. I know I can store the original positions using .particleVector. How can I send a particle back to its position while being influenced by forces etc?
Thanks
Mark
Here is a R&D trying to do pin-art with pflow.
Please note with the Speed by Surface set to Continuous
and my hacked script set to evaluate every frame this
R&D scene would be dreadfully slow (like Month of Tuesdays)
if it had to evaulate more than a few hundred particles.
I would be interested to see how much faster a Box #3 solution would be.
Here is the script contained in the scene
on ChannelsUsed pCont do
(
pCont.usePosition =true
pCont.useSpeed=true
pCont.useScale=true
pCont.useTime=true
)
on Init pCont do
(
)
on Proceed pCont do
(
t = pCont.getTimeEnd()
count = pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
CurID=pCont.particleID
--if (pCont.particleNew) then
(
poffset=pCont.particleScalexyz.y=at Time t abs(-length(pCont.particleSpeed)*400 )
pCont.particlePosition.y=at Time t -pOffset*5
--the pOffset is an attempt to stop the scale from bringing the
--partcles past the 0y grid; as I only want the boxes to
--extrude towards the camera
)
)
)
on Release pCont do
(
)
I have a PFlow system I'd like to script but I'm not sure how to approach it. I'd like to have a camera move through a static field of particles but be birthing and destoying particles on the fly at a specific cutoff point. Kind of like an on the fly 'volume create' inside a specific radius around the camera. The particles themselves would remain static once created until destoyed (when the camera moves a certain distance away).
Is this possible? Any hints on where I should start?
Thanks
Mark
Hi. I'm having trouble with MtlIndex. I have a BirthScript that's setting MtlIndex with pCont.setParticleMtlIndex i 1 etc. The particles travel through a couple of events and end up in an event that's meant to crossfade the material from one to another. I have a MaterialDynamic operator referencing a Blend material with a particleAge map in the mask slot.
The trouble seems to be, I can't get the crossfade to work unless I check 'AssignMaterialID' in the MaterialDynamic operator. But then that overwrites the MtlIndex I set in the BirthScript.
How can I keep my MtlIndex values and still have the MaterialDynamic/ParticleAge map combination work properly? And, I can't find anyway to print MtlIndex values to the listener. How can I do that?
Thanks
Mark
I have a BirthScript operator creating particles at a certain scale. I’d like the particles to be ShapeFacing, but I can’t find any way to specify the target object in Help. So I put a ShapeFacing operator after the BirthScript, but it looks like it’s overwriting the scripted scale. How can I get around this?
Thanks
Mark
hello,
i tried to create an own type of fireworks via pflow with help of the in 3ds max included birthscript. I changed the birthscript a little to my needs.
So far all works fine. 12 particles will created over time in more and more shorter time steps. But if I add/ activate a Force operator, which includes a Gravity, I get unwanted additional particles. The Gravity is necessary to simulate the slowdown of rockets rising up to the sky and in the end for a speed test and the final deleting of all this 12 particles related to their z-velocity/speed. I gues this effect comes because the Force 02 in my script and the BirthScript collide anywhere.
I hope anyone of you will find a solution. I’m a newbie in scripting and a beginner in pflow. The best way maybe to study and change my pflow system by yourself.
I attached 2 screenshots - one with Force 02 on and one with Force 02 off. The red dots markes the guesed original 12 particles. Furthermore I attached a 3ds max 2009 file. It includes the Pflow system with Force 02 set off.
I am trying to gather TM data from particles and get it into an array to be used by an external script. I have no idea how to get it to work. I have seen examples of data going the other way, ie array data being sent to the particle.
Any ideas would be great!
Hi, I have a quick question regarding scripting in pflow.
I have adapted this simple script that sets an object to the particleTM and would like to include an easy way to select the object you want it to effect.
Is there a way of doing this either through the script or getting the info from a data flow operator?
Mock up
[url=http://www.postimage.org/image.php?v=gx2ytPS][img]http://www.postimage.org/gx2ytPS.jpg[/img][/url]
[url=http://www.postimage.org/image.php?v=Pq1M8Si][img]http://www.postimage.org/Pq1M8Si.jpg[/img][/url]
I would be greatful for any help.
Phil[/img]
For the life of me, I can not figure out how to create a script where the
spin rate increases as the particle age increases.
Here is the script so far, it shows via display script that all the
particle spin rate increased per frame, but not per particle age.
Any help is most appreciated!
-- This is a script that can be used to set up particle spin
--
-- Created: 4-17-2006
-- Last Updated:
--
-- Author : Oleg Bayborodin
-- Version: 3ds max 6.0
--********************************************************************
-- MODIFY THIS AT YOUR OWN RISK
on ChannelsUsed pCont do
(
pCont.useOrientation=true
pCont.useSpin = true
--pCont.useVector=true
pCont.useFloat=true
)
on Init pCont do ()
on Proceed pCont do
(
count = pCont.NumParticles()
for i in 1 to count do
(
CurAge=pCont.particleAge
pCont.particleIndex = i
sp = pCont.particleSpin
sp.angle = 360.0*(CurAge/75.0)/4800
sp.axis = [1, 0, 0]
pCont.particleSpin = sp
--pCont.particleVector=sp.axis
pCont.particleFloat=sp.angle
)
)
on Release pCont do ()
Speed transition example:
[b]Event 01[/b] sets the speed to 100
[b]Event 02[/b] sets the speed to transition from 100 to 30 within 15 frames
[img]http://www.orbaz.com/forum/files/test_speed_transition_pview_153.gif[/img]
[img]http://www.orbaz.com/forum/files/test_speed_transition_872.gif[/img]
[code:1]on ChannelsUsed pCont do
(
pCont.useSpeed = true
pCont.useVector = true -- store original speed here
pCont.useFloat = true -- store random multiplier here
pCont.useEventTime = true
)
on Init pCont do
(
global newSpeed = 30
global newSpeedVar = 0
global transitionTime = 15
global transitionTimeVar = 0
global speedConversion = 0.0208333
)
on Proceed pCont do
(
count = pCont.numparticles()
for i in 1 to count do
(
pCont.particleIndex = i
if pCont.particleNew then
(
pCont.particleVector = pCont.particleSpeed
pCont.particleFloat = pCont.rand11()
)
else
(
variance = pCont.particleFloat
oldSpeedVec = pCont.particleVector
newSpeedVec = (normalize oldSpeedVec) * ((newSpeed + (newSpeedVar * variance)) * speedConversion)
pTime = pCont.particleEventTime as float / ticksPerFrame
tTime = transitionTime + (transitionTimeVar * variance)
p = if pTime <= tTime then pTime/tTime else 1.0
finalSpeedVec = (1-p) * oldSpeedVec + ( p * (newSpeedVec/100.0) )
pCont.particleSpeed = finalSpeedVec
)
)
)
on Release pCont do
(
)
[/code:1]
You can then adjust these settings from the script:
[b]global newSpeed = 30
global newSpeedVar = 0
global transitionTime = 15
global transitionTimeVar = 0[/b]
topic inspiration was from this thread at cgtalk:
http://forums.cgsociety.org/showthread.php?f=206&t=701344
[url=http://www.scriptspot.com/3ds-max/pf-channel-info]PF Channel Info[/url] @ [url=http://www.scriptspot.com/]Scriptspot[/url]
This script will display accessible particle flow channels into a list view.
[url=http://www.scriptspot.com/3ds-max/pf-channel-info][img]http://www.scriptspot.com/files/u149/PF_Channel_Info.gif[/img][/url]
[size=9]I just thought that this would also be a good place to (shamelessly) plug a script i made a few weeks ago. :D [/size]
I'd really appreciate some help on this one.
I need to shrink and grow particles depending on their apparent size, not their actual size.
The particles in the data I'm working on have variation in their scale, but it looks like my script operator is overwriting the variation. Anyhow, I have all these particles of various sizes and positions and the camera moves through them. When the apparent size of a particular particle reaches a threshold (ie starts to look too big), I need to slowly ramp down the scale so that it holds at some minimum apparent size. When this minimum apparent size is reached, the appearance of the particle needn't change. Just hold at that apparent size. Then as the camera moves away and passes the theshold on the way out, I need the particle scale to ramp up again so that it retuens to an unaltered scale.
I've given it my best today, but I'm reaching the limit of my powers. Can somebody give me a hand? I've attached a sample file. Is this even possible?
Thanks
Mark
Hi all,
this file is driving me nuts. Works when scrubbing forward the timeline, doesn't at rendertime. It's like if Pflow won't get the changed vertex selection - change that happens thanks to a vol. select modifier. Attached the pflow scheme and a max 2008 file.
Thanks!
i'm using a script to apply an alternate material to a group of objects that a particle flow is using as a shape_intance (with "acquire material" enabled).. unfortunately, after i apply the material the particle flow is not aware of it until i toggle the "acquire material" checkbox. this then refreshes the material and the system renders correctly.
this isn't a big deal, though, since i can script this toggle behind the scenes. setting the Acquire_Material property for the shape instance 'off' then 'on' in the maxscript listener works properly to do this, as does creating a function in a maxscript.
however, the same exact function used within a larger maxscript struct is not having the same effect.. although the function is running (verified with various print/test statements) and the property *is* toggled, the operation breezes by and has no effect on updating the material. i even tried adding a "sleep" to allow the property to set.
is there anything about particle flow's (or maxscript's) behavior that might be preventing this from working? is there a better way--in script--to update a shape instance's material?
thanks for any help..
greg
blur studio
venice, ca
Hy everyone,
Is it possible (as far as pflow with box 1 go) to make a birth or a spawn on the surface of an instanced object (where the object is instanced also using particles).
Thank you.
I was wondering if there is a classof for all operators and all tests?
like the [i]PF_Source [/i]or the [i]Event [/i]one.
i need it as Conditional statements.
for the Events, I used this one;
[code:1]for o in helpers do if classof o == event do append PFSEvent o[/code:1]
or if i put them all in an array like this;
[code:1]global OperatorsTest = #(birth, Birth_Script, deleteParticles, Position_Icon, Position_Object, rotation) [/code:1]
how could i use this array in my conditional statements.
I tried a lot of different ways, but nothing
thx in advance
Hello,
I was wondering if anyone could explain what it means when a script operator works during a viewport animation but when it comes to actually rendering it, it does not work.
Edit: This has nothing to do with material effects like transparency or particles being occluded in any way. My question is more about what is the difference between viewport rendering/playback and actual image rendering/output that would allow a script operator to work correctly during viewport playback but not at all in actual image output rendering because of some flaw in a script operator (apparently).
Do you humans understand what I'm saying?
Hi
I have a bunch of facing particles that I’d like to have bursting. I’m using an animated Scale operator to control the size animation. The trouble is, I’d like the particles to have a fixed size relative to the camera throughout the animation, so I added in a Script operator. I thought I had it working. But when I try to render out a sequence, the Script operator doesn’t seem to be kicking in. Rendering single frames sometimes works, sometimes doesn't. Turning off the animated Scale operator doesn't make any difference.
Here's a sample ....
[url]http://www.digikoku.com/download/pflow_problem/PflowScaleScript_002.zip[/url]
Can anybody tell me what’s going wrong?
Thanks
Mark
Hi,
its my first time here, so sorry when I post this in the false forum chapter.
I have some problems with two scripts in my particle flow.
first her the code:
[code:1]
on ChannelsUsed pContRP01 do
(
pContRP01.useTM = true
pContRP01.useAge = true
pContRP01.usePosition = true
)
on Init pContRP01 do
(
global My_OmniRP01 = $OmniRP01_*
My_OmniRP01.pos = [0,0,-10000]
)
on Proceed pContRP01 do
(
partcount = pContRP01.NumParticles()
count = amin #(partcount,My_OmniRP01.count)
if (partcount < 1) do
(
My_OmniRP01.pos = [0,0,-10000]
)
for i in 1 to count do
(
pContRP01.particleIndex = i
-- My_OmniRP01[i].transform = pContRP01.ParticleTM
My_OmniRP01[i].pos = pContRP01.particlePosition
My_OmniRP01[i].pos.y = (My_OmniRP01[i].pos.y) - 300
)
)
on Release pContRP01 do
(
)
[/code:1]
[code:1]
on ChannelsUsed pContEF02 do
(
pContEF02.useTM = true
pContEF02.useAge = true
)
on Init pContEF02 do
(
global My_OmniEF02 = $OmniEF02_*
My_OmniEF02.pos = [0,0,-10000]
)
on Proceed pContEF02 do
(
partcount = pContEF02.NumParticles()
count = amin #(partcount,My_OmniEF02.count)
if (partcount < 1) do
(
My_OmniEF02.pos = [0,0,-10000]
)
for i in 1 to count do
(
pContEF02.particleIndex = i
My_OmniEF02[i].transform = pContEF02.ParticleTM
)
)
on Release pContEF02 do
(
)
[/code:1]
I only want to attach omni lights on some particles.
I copied this script into three particle flows (with name changes, of cause)
Here is a screen capture of the particle flow:
[url=http://www.postimage.org/image.php?v=aVgqhIJ][img]http://www.postimage.org/aVgqhIJ.jpg[/img][/url]
With the first PFlow the script usualy runs correct.
With the second and third PFlow only the first script (i post) runs.
I tried to fix it but without positiv results.
So can anybody help me, please.
Thanks in advance
Volker
hi all,
is it possible to add some rollouts in a script operator or test?
i'm using some elements from the scene in my scripts most of the time and instead of changing the names in the scripts, i was wondering if it was possible. so from the pfview i can select my object.
I'm trying to use object-chunks pflow birth script but with the added joy of being able to retain the pivot orientation of the source mesh's within the particle.
When pflow creates the chunks, the particle rotations are all [0 0 0] rather than the rotation that I have specified by rotating the mesh pivots.
The script below is getting close to what I want but some objects are 180 degrees off of what they should be if I was to local-rotate the source objects. I assume its because I'm using euler and quat values when I need to use angleaxis values.
Any ideas how I can fix the math to get the result I'm looking for?
[code:1]
on Proceed pCont do
(
t = pCont.getTimeStart() as float
if t > 0 do
(
NumChunks = ChunksArray.count
tt = ((t/160))
if tt < NumChunks do
(
pCont.AddParticle()
pCont.particleIndex = pCont.NumParticles()
pCont.particleAge = 0
pCont.particleTM = ChunksArray[tt].objecttransform
pCont.particleShape = ChunksArray[tt].mesh
a = ChunksArray[tt].objectOffsetRot as eulerangles
aq = ChunksArray[tt].objectOffsetRot
rq = (eulerangles 90 0 0) as quat
nr = (inverse aq * rq) as eulerangles
pCont.particleorientation = [ nr.x,nr.y,nr.z]
)
)
)[/code:1]
My other thought is I need to normalise the quat values.... but then again, I dont actually understand what normalising a quat value does! Can anyone care to explain what it does, and in what situations you would want to normalise quat values?
Hi, I am trying to learn Maxscript and something that I've found really helpfull is going trough scripts that more experienced Maxscripters have done and try to decipher them.
I try to go as far as I can, using resources like trial and error Maxscript reference or the internetnet, but sometimes there are parts of a code that I just can't understand why is there.
If someone could help me understanding a small part of this script, I would really appreciate it.
This Script was made by JBHaywood and you can find it at http://www.orbaz.com/forum/viewtopic.php?t=311&postdays=0&postorder=asc&start=30
[code:1]mapped fn splineGrow obj startFrame:0 = (
if not canConvertTo obj splineShape do return false
-- make sure the shape is a collapsed editable spline obj
if classOf obj == line do (
addModifier obj (edit_spline())
)
convertToSplineShape obj
animateVertex obj #all
startNum = 0
-- loop through each spline within the spline object seperately
for s = 1 to numSplines obj do (
-- create bitarray of knot indexes for current spline
local knotArr = #{1..numKnots obj s}
-- get the total number of knots
local n = knotArr.numberSet
-- create array of positions for each knot so we know where they should end up
local knotPosArr = for i = 1 to n collect in coordsys obj (getKnotPoint obj s i)
-- this is where the magic happens
for i = 1 to n do (
-- define the end of the following loop
local n2 = startNum + (n * 3)
-- animate only the Vertex master control points, not the InVec or OutVec points
for j = ( (((i * 2) - 1) + i) + startNum ) to n2 by 3 do (
-- set keys for the position of the knots
animate on (
-- for the first iteration of the loop, set all the knot positions to the position of the first knot at frame zero
if i == 1 do (
at time 0 obj[#Object__Editable_Spline][#Master][j].value = knotPosArr[i]
)
-- then start setting keys at the startFrame plus the current loop iteration
at time ((startFrame - 1) + i) obj[#Object__Editable_Spline][#Master][j].value = knotPosArr[i]
)
)
)
startNum += n * 3
)
)[/code:1]
What I can't understand is the following:
1) at
[code:1] for i = 1 to n do (
-- define the end of the following loop
local n2 = startNum + (n * 3)
-- animate only the Vertex master control points, not the InVec or OutVec points
for j = ( (((i * 2) - 1) + i) + startNum ) to n2 by 3 do ([/code:1]
why is n multiplied by 3 and why is i multiplied by 2, the result is substracted 1 and this is added the start number?
2) why is it that at the end we chenge the startNum value by the operation [code:1]startNum += n * 3 [/code:1] why isn't it just added one (or something on those lines)?
3) this is kind of a general question:
I have trouble understanding exactly when is important to use global and when is important to use local on the variables, and do I have to use them at all or are they implicit and some people just like to use them?
I hope someone can throw some light into that, Thank you very much in advance.
Hi,
after a very long time working with everything but particles i found myself
struggling to get back into it. here's my problem: i'm trying to create a disassembly/reassembly animation using a chair made of lots of nurbs surfaces. so i linked my objects to dummies and got pflow to control the motion of these dummies but now i'd like to know how i can get the initial state of my pflow to lock on the dummies original position (so that i get the assembled chair on frame 0 then go to disassemble it). hope that makes sense...
Hi, I wanted to get a selectByName box to display pflow objects.
Also Wanted a bit of info on how they are "system hidden" objects etc.
Its always been a bit of a mystery to me.
Cheers,
Jordan
Hi all,
I've got a problem with a script I'm writing to generate PFlow fireworks using data from a CSV text file, which contains the position, start time, color and firework type.
At the moment, I've only got one type of firework defined, but when the script is finished there will be 5 or 6 different types. The script works fine as long as I'm only defining one event per PF_Source, but as soon as I add a second event in the script, the whole thing just bogs down.
I've uploaded a simplified max scene, the script, the material library needed by the script and a sample CSV text file, all of which you can get here:
[url]http://www.maxplugins.de/r2008_files/PyroScript_V1_2.zip[/url]
I've commented out the second event in the script, and it generates the 87 PFlows in about 25 seconds. If I add the second event back in, by the time the script is up to the 20th PFlow, it's taking around 20 - 25 seconds per system, and that time is increasing with every new system that gets added...
If anyone has got any ideas, or spots a really stupid mistake on my part, I'd be very grateful.
Cheers,
Dave
Hi all.
I'm trying to run a simple script from inside a 3dsmax plug-in using both ExecuteMAXScriptScript() or ExecuteScript(). The problem is that after the script gets executed, I can see all my Particle Flow entities created in the scene, but something inside the whole Particle Flow system is not updated properly (or at least it looks that way), because it doesn't emit/do a thing.
The argument for the "not properly updated" affirmation is that if I simply save and reload the scene, everything works as expected. Even more, if I run the script using MAXScript Listener's Run Script..., everything works as expected.
Here's the script:
[code:1]rfPs = PF_Source()
ev1 = Event()
particleFlow.BeginEdit()
ev1.AppendAction (Birth())
ev1.AppendAction (Position_Icon())
ev1.AppendAction (Speed())
ev1.AppendAction (DisplayParticles())
particleFlow.EndEdit()
rfPs.AppendInitialActionList ev1[/code:1]
I even tried to update the PF_Source() from C++ (as a Particle System) by sending the node back in C++, but no luck.
I've tried this scenario in all 3dsmax versions starting with 7 and ending with 2008 (x86, x64).
And last but not least, I'm interested in knowing if it's possible to have a PF_Source() set in a way in which my plug-in will be called only for one specific frame and not for all past frames until that this particular frame. I'm asking this because I use PFlow with particles loaded from files, so I don't need the entire past particles life sequence, only the current frame.
Any advice will be greatly appreciated. Thanks.
I have some pflow rocks in an explosion. I wanted trails of dust coming off them. I tried to use a mesher of the original rocks in the object position of the dust particles but got instant max crashes. I can spawn just off the rock particles but then they only spawn from the pivot of the rock geometry.
Is there any way to spawn from a volume around a particle, say based on the scale of the particle, rather than just the exact location of the particle?
I dont have box3 but I assume some type of scripty operator would help.
Cheers!
First hi all,
and thx for this forum Oleg
I'm trying to get a trigger with a script test for an other Particle Source Test.
But I can't find how to do it.
for now I'm using an Age Test in my second PFS...
[img]http://www.holycause.com/3dscool/divers/PF_Trigger_Test.jpg[/img]
EDIT #2 Although the test works on particle count (once the test is evaluated true and the foo=$workaround is greater than 45 degress on the
x absolute value); and it goes to the delete; and the particles drop down
to zero count as expected.
This happens when I preview OR scrub; but when I render the face count
in the render dialogue stays constant and no particles are deleted by the
script test.
Please see enclosed file.
EDIT #1
So, I came up for a workaround, I created a non-rendering box in the
enclosed file called WORKAROUND, wired the height to the x rotation of the camera target and then assign foo to equal the workaround;
when the height of the box>45 the script test is true.
Everything works in the viewport but when I render the scene, its as
though the test never happened.
please see enclosed file
http://agilemedia.biz/mark/scripttest.zip
NEW SCRIPT
[i]
on ChannelsUsed pCont do
(
pCont.useTime = true
)
on Init pCont do
(
global FOO=$workaround
)
on Proceed pCont do
(
count = pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
--print foo.height
IF abs(foo.height)>=45 then
(
pCont.particleTestStatus = true
pCont.particleTestTime = pCont.particleTime
)
)
)
on Release pCont do
(
)[/i]
Is there a way to make the "isParticleNew()" function work when the timeline is scrubbed and played backwards?
Hi!
I've just started scripting PFlow (yay to me), trying to create some sweet bubble motion particles. I get this weird update issue that I hope someone knows anything about. When I play the particles in the viewport, they look OK - but as soon as i scrub backwards or render, the motion is completely wrong.
Here's the script:
[quote]
on ChannelsUsed pCont do
(
pCont.useSpeed = true
pCont.usePosition = true
pCont.useScale = true
)
on Init pCont do
(
)
on Proceed pCont do
(
bubbleOffset = 117 -- Should not need to be touched
bubbleFreq = 30
bubbleStrength = 7
count = pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
bubbleSpeed = (pCont.particleSpeed.x + pCont.particleSpeed.y + pCont.particleSpeed.z)*20
bubbleScale = -pCont.particleScale+2
bubbleMotion = ( sin( (currentTime*bubbleFreq*bubbleScale*bubbleSpeed)+(i*bubbleOffset) ) )*bubbleStrength
pCont.particlePosition += [ bubbleMotion, 0, 0 ]
)
)
on Release pCont do
(
)
[/quote]
Can anyone see what I could have done wrong?
Thanks, Rune
My code has a snippet in it that goes like this:
[code:1]pf = $PFSource01
curInt = pCont.particleInteger
theMatrix = (pf.getParticleTMByID curInt)
worldUpVector = [0,0,1]
partVector = (pf.getParticleVectorByID curInt)[/code:1]
The line (pf.getParticleTMByID curInt) seems to work (although I've had a lot of trouble with the rotation component being wrong)
But the (pf.getParticleVectorByID curInt) line throws up the following error:
-- Unknown property: "getParticleVectorByID" in $PFSource01
I just can't figure out how to access this value from another event.
I get the same thing when trying to use getParticleMatrixByID
Thanks in advance for any hints!
Rhys.
is there a way to execute Bobo's or Allan's fragmentation (particles to mesh) script at a certain frame other than 0 (let's say 60) ? :?
....or as a work-around how would I animate the visibility of the particles/mesh in the render ?
[code:1]
on ChannelsUsed pCont do
(
pcont.usetm = true
pcont.useshape = true
)
on Init pCont do
(
global FracCol = $Fragments_* as array
)
on Proceed pCont do
(
t1 = pCont.getTimeStart() as float
t2 = pCont.getTimeEnd() as float
if ((t1 <= 0) and (t2 >= 0)) then
(
(
pcont.addparticles FracCol.count
for i in 1 to FracCol.count do
(
pcont.particleindex = i
pcont.particleshape = FracCol[i].mesh
pcont.particletm = FracCol[i].transform
)
)
)
)
on Release pCont do
(
gc()
)
[/code:1]
is there a way to access variables in plflow with a gui made in max script?
i was curious on how to control a particles speed continuously. i tried playing with charley's orientation script but it doesn't give me what i need.
[code:1]
on Init pCont do
(
)
on Proceed pCont do
(
count = pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
pCont.particleSpeed = pCont.particleTM[3]
)
)
on Release pCont do
(
)
[/code:1]
it gets a little wacky and its hard to control the look of them.
i know that i would have to multiply the particles age, or time by the sin/cos function just not sure how to do this though.
Maybe im missing the easy solution but is there a way to color a spawned particle by the age of its parent? Say i want to leave a colored trail behind a parent particle and the trail color at x point in space is colored based n the parents animated color.
Thanks
-michael
So I’m sure this has been done any of number of times but seeing as im just starting in on script I hope I can get a bit of a hand. I’m doing a fireworks system currently and eventually want both afterburn and fume working with particle based lighting. Bobo was kind enough to set up a basic scrip that links whatever to the position of a particle and I’m using that as the basis of what I’m trying to do. Currently it grabs a light or whatever for each particle in the event. Naturally with thousands of particles I want to only have a light or gizmo for every nth particle. Not sure what the syntax is. Also in the case of lights Id like to base the multiplier on the age of the particle in that event. And it would be great to grab the color if at all possible. Right now I don’t have box3 in this setup.
Any help would be fantastic.
Thanks
-Michael
on ChannelsUsed pCont do
(
pCont.useTM = true
pCont.useAge = true
)
on Init pCont do
(
global My_Light_01 = $Omni*
My_Light_01.pos = [-1000,0,0]
)
on Proceed pCont do
(
partcount = pCont.NumParticles()
count = amin #(partcount,My_Light_01.count)
for i in 1 to count do
(
pCont.particleIndex = i
My_Light_01[i].transform = pCont.ParticleTM
--My_Light_01[i].radius = 10
)
)
on Release pCont do
(
)
I am trying to get my particles (that right now are projected along the y
axis towards the camera) to diverge along the x and z axis as they age.
I have tried scripting this and wonder if someone has a script that works
that allows a particle to diverge off its y path as it ages?
Hello :)
I was wondering if any of you scripting geniuses could help me find the closest point on a surface to a particle.
I've tried the methods suggested here...
[url]http://forums.cgsociety.org/showthread.php?t=377194[/url]
...but found them inaccurate.
Any help would be greatly appreciated.
Thanks
I have a 20 second animation I'm trying to loop. A Script operator handles spin. I have the spin rate looping fine, but I'm getting incorrect results when I try to introduce variation into the spin axis.
The below script works if I confine the spin to a single axis. But if I go with more than one axis or try to randomise, the animation doesn't loop. What's the problem? Shouldn't randomising just give each particle a spin direction so that it still completes its rotation in the time set by sp.angle?
[code:1]on ChannelsUsed pCont do
(
pCont.useSpin = true
pCont.useTime = true
)
on Init pCont do (
a = 18.0/4800 -- 20s
b = 36.0/4800 -- 10s
c = 72.0/4800 -- 5s
d = 90.0/4800 -- 4s
global spinAngles = #(a,b,c,d)
)
on Proceed pCont do (
t = pCont.getTimeStart() as float
if t < 0 do (
count = pCont.NumParticles()
for i in 1 to count do (
pCont.particleIndex = i
sp = pCont.particleSpin
pickSpin = random (1) (spinAngles.count)
sp.angle = spinAngles[pickSpin]
--pickXAxis = random (0.0) (1)
--pickYAxis = random (0.0) (1)
--pickZAxis = random (0.0) (1)
--sp.axis = [pickXAxis,pickYAxis,pickZAxis]
sp.axis = [0,0,1]
pCont.particleSpin = sp
)
)
)
on Release pCont do (
)
[/code:1]
Thanks
Mark
Hi
How can I birth script/position script into a volume?
Thanks
Mark
Dear,
I have attech max file and script.I dont know scripting but tring to learn .
I have done this some body given in user gallery.When i run this script
"it-test requires booleanclass,got :[0,0,0]"error ouccers.
I cant understand why ?
Please help
Thanking u
Alpa
Hi,
I'm trying to achieve a similar effect to this clip [url]http://www.toxic.no/php/vis_film.php?id=54[/url]
Find target isn't a good solution since it actually attracts particles & creates a non organic feel. Also using the Find Target as a test operator doesn't do the job, since the test is just for the surface or pivot point.
The approach I tried was using MaxScript to test for intersection of the particles and the target geo.
I used a Boolean operation (- or *) for testing numVerts before and after the operation.
This technique works great for standard primitives, but I'm having trouble with extruded editable splines.
Any ideas on the MaxScript problem or a tootally different approach to the problem?
Thanks
Eran
Dear Oleg,
I have download scripting tutorials from which u have given me site name.
Well i know some c++ language.I want discription of that interaces and methods which are we use for flow.From where i get it ? I dont know about maxscript.How can i start ?
Thanking u
Alpa
I'm doing a lot of creating particle flow systems through scripting lately, but one thing I can't figure out is how to change the properties of an event within the script. For example, say I want to turn off shadows for a certain event that creates the smoke in my scene, or I want to turn on motion blur for another specific event. Setting the property within the script doesn't seem to work. Here's a psuedo-code sample:
ev = event()
ev.castShadows = false
Now after this event is created and the scene is rendered, the particles in the event are still casting shadows. If you right-click on the event in the PFlow view window and select "Properties", it shows that Cast Shadows is turned on. But if you query the event through the maxScript listener, it returns "false". It's almost like there are two different events, the node in the scene (which is the one created by the script) and the event window within the main PFlow viewer. And the only way to change the property is to manually right-click on the event in the window and change it there.
Is this correct? Is there some method to change the property through scripting that I'm missing?
I searched in the helpfile for the script of the find target operator. but there were only the things, which are also visible in the operator itself(in the Pview)
I would like to know the scripts which takes the position of the selected geometryobject, and animates the particles in time to this position.
and then i wonder if it would be possible to replace the position values with transformation matrices :)
that would be great.
I was involved in a discussion over the CGTalk forum that showed some interesting aspects of PFlow scripting vs. usage of the Data Operators in Box#3. I copied the content of the discussion to this forum. I mention the author in the beginning of each message.
Thanks,
Oleg B.
This seems to me to be a very simple problem, but I have spent days searching the net and no one has the same problem. Particle flow produces particles which use the world as a reference “stationary”. So for example, a simple particle flow is set up. The emitter is linked to an animated object. The emitter will follow the object but the particles will only inherit the motion at birth. This produces curved trails and spirals. I want to change the coordinate system of the particles so that there motion is relative to the emitter, not the world.
I have had a look at scripting and tried to understand what is going on, but at this stage it is all way beyond me.
I would really appreciate it if there is someone out there who could give me a hand.
Thanks
so i was wondering if there is simple solution for this before i start typeing needless lines of max script.
there are times where i want to list every object in the scene but exclude or filter pflow operators.
the problem I'm having is that if i test the superclassof of an operator i get "Helper" class. not very usefull unless i want to filter all helpers.
is there a list of or array in max that tells me what are the availabel pflow operators that i can test against??
or maybe a is (isVlaidPlfowOperator) function? what does the "select by name" dialog test against to filter the operators? is the something exposed to max script ?
do i need to generate a list of operator classes by hand, every time there's a new operator type, so i can test against it?
any help would be truly appreciated.
cheers,
Los.
Carlos Anguiano
Digital Aritst/TD
D2
Hello again,
I will now reformulate my question.
I think I am missing some little but crucial knowledge of TMs:
See this proceed part of a script operator:
[code:1]on Proceed pCont do (
count = pCont.NumParticles()
for i in 1 to count do(
tempPosLT = random [10,10,10] [-10,-10,-10]
pCont.particleIndex = i
look = normalize (tempPosLT - pCont.particlePosition)
m = matrixfromnormal look
pCont.particleTM = m
)
)[/code:1]
This makes the particles "spin" in a random way. And it renders.
Now take a look at this snippet:
[code:1]on Proceed pCont do (
count = pCont.NumParticles()
tempPosLT = $MagnetViz.pos
for i in 1 to count do(
pCont.particleIndex = i
look = normalize (tempPosLT - pCont.particlePosition)
m = (matrixfromnormal look)
pCont.particleTM = m
)
)[/code:1]
instead of generating a random tempPosLT vector this snippets takes a position of a moving scene object.
It looks right in the viewport, but does not render the same way.
I read in this forum, that this has something to do with the "integration step value" and when and how the position of the reference object is fetched.
But I cannot find the solution ...
Georg
Hi,
can someone tell me, why this does not work ?:
I have two PFlow-Sources "FlowA" and "FlowB".
In "FlowA" a Script-Operator is used to "mark" (or set a flag for) some of the particles. I tried to mark some particles using "pCont.particleselected = true" (tried also "pCont.particleinteger = 1").
All unwanted particles were flaged different with "pCont.particleselected = false" (or "pCont.particleinteger = 0").
Then in the second Flow ("FlowB") i now tried to access Position,speed,... of the marked particles from "FlowA" using:
sourcecount = $'FlowA'.NumParticles()
for i in 1 to sourcecount do
(
$'FlowA'.particleIndex = i
if (($'FlowA'.particleselected) == true) do (something) --<<-gives me an error !?
if ($'FlowA'.particleinteger == 1) do (something) --<<-gives me an error, too !?
)
What is wrong ?
edit: i donn´t own the #ToolBoxes, i have to use scripting for this.
Hello!
I have a problem, I got a very simple pflow, there´s one instance shape operator that changes the scale of the instanced object with a variation, and below there´s a script operator that rotates the particle using particleTM. The problem is that if the script operator is active I lose the scaling applied by the shape instance.
So I have the shape instance operator working ok, the script operator making the rotation ok, but I can´t have the two operators active at the same time! :?
I have tried to put the scale before and after the script and it doesn´t work...
Please help, thank you!
Tony
:wink:
Hi everybody!
I've been wondering if it would be possible to set up a flow to switch between two shape instances depending on distance to camera. The idea is you would have a low res and a full res model, but only those close to the camera would use the full res model. I understand this would only work where the two models are very close in shape/outline, and will probably still need heavy DOF to hide the transition......
I'm not too good at scripting, but it sounds like this is the kind of thing that could be done. It occurs to me that the major problem may be the TM of each particle - so that each switch replaces the low res with the full res model with exactly the same orientation/spin.
Over to you scripters.....possible??
Oleg - If it can be done with Box 3, I'd like to see how, but we don't have Box 3 at work ( :evil: ), so a script solution would be best.
Thanks
Z.
Hello all
I am trying to create in 3dsmax an animation that simulates the "airline route" diagram ..
to be more specific, what I mean is a globe of the earth and a large number of arcs that spread from a specific location (like new york for example) to other parts of the world..
I was thinking about using a B&W map in order to "tell" the particles where to hit their mark, Oh, and by the way.. I need it backwards meaning the arcs come out around the globe and converge at one specific place.
I have no scripting skills although I do know how to use them (obiously :roll: ) I hope maybe someone has made something similar.
Thanks in advance
Daniel
hy all. :cry:
i don´t have my scripts at hand right now but need a birthscript urgent :(
the thing is i need a script that spawns only as much particles as there are vertecies on the position object+ (i allready tried "vertecies all" but i want pflow only to spawn as much as there are on the object not a given amount on every vertex...)
i think it´s something very silly :oops: but it seems i don´t have the given time to do some search :cry:
regards and thanks in advance
anselm
Hi people,
That's what I need:
I have particles in one event, and particles in another event in another PFSource. When the distance between a particle of one event and a particle from the other drops below a threshold, i need to send the two particles to two new events one in each flow.
And since I am a newcommer to scripting, though I have a little background in programming, I imagine the following solution (identical operator for the two events):
-record the particle position channel in a global array variable, one for each operator
-calculcate the distance between each particle in one of the arrays and the particles in the other. If a particle is below the threshold, send it to the new event.
Could you tell me how to syntax this? A decent intro to scripting PFlow will also be a great read!
Thanks a lot,
Hristo
Hi I have some maxscript knowlege but its my first time for particle scripting.
I have a vert cloud with a vert count increaces over time and I want to match the birth of particles to the increace in verts.
For each vert that appears I want a particle in its place.
here is what I have fumbled together. It doesnt work.
[code:1]on Proceed pCont do
(
for i = 0 to 220 do
(
curTime = i
newVertNum=(at time (curTime) $'DistributionObject_01'.numverts) - (at time ((curTime)-1) $'DistributionObject_01'.numverts)
if newVertNum > 0 do
(
for j = 0 to newVertNum do
(
pCont.AddParticle()
pCont.particleIndex = pCont.NumParticles() -- last particle that was added
pCont.particleTime = curTime
pCont.particleAge = 0
)
)
)
)
[/code:1]
Any ideas?
Chees
it's is possibility to count (exactly put names to array) all events that belong to specific particle systems?
i'm a little bit confused with [i]getNumInitialActionLists()[/i] / [i]getInitialActionList() [/i]
:(
Maybe is possible to find events by objects class - [i]Event[/i]? But how detect which event belong to which particle systems? :?
Can somebody help with this?
P.S. here is script that i try to do [url]http://deko.lt/tmp/FXCtrl03_pf.ms[/url]
Thanks,
Hi everybody!
I'm trying to make a flow where the particles start on the surface of one geosphere (the source), wait a bit, and then move to the surface of another geosphere (the target).
I'm using Allan Mackay's technique to set the target position first using a position object, then write this position to a script vector, before using another position object to start the particles off on the source object. This allows me to use a find target set to script vector to send the particles exactly where I want them on the surface of the target.
My problem is that while the vector channel records the position data, I lose the rotation data. I want to be able to use a go to rotation at the same time as the find target so the particles find their position and rotation on the target object.
I assume this will need two scripts. The first to record the rotation before the second position object, and the second to sit later after a go to rotation, containing the rotation target data.
My problem is I'm really new to scripting and I don't really know where to begin. I would really appreciate a Box 3 solution (as I'm sure Oleg will suggest), but I'd also love to see how this can be achieved via scripting alone - it's the only way I'll learn!!
Thanks
Z.
ps. The script I'm using for the position vector bit is:
[code:1]on ChannelsUsed pCont do
(
pCont.usePosition = true
pCont.useVector = true
)
on Init pCont do
(
)
on Proceed pCont do
(
count - pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
if (pCont.particleNew) then
( pCont.particleVector = pCont.particlePosition)
)
)
on Realease pCont do
([/code:1]
Hello,
I am trying to control the multiplier of light using the age of a part.
I have omni lights following the parts, but i want the mulitplier to decrease
to 0 on the parts death.
i can get the function to work in the listner but not as a script op.
any ideas
heres the script
on ChannelsUsed pCont do
(
pCont.useTM = true
pCont.useAge = true
)
on Init pCont do
(
global light_01 = $OmniSpark*
light_01.pos = [0,0,-100000]
)
on Proceed pCont do
(
partcount = pCont.NumParticles()
count = amin #(partcount,light_01.count)
for i in 1 to count do
(
pCont.particleIndex = i
light_01[i].transform = pCont.ParticleTM
light_01[i][4][2].value = abs(1 - (pCont.particleAge / 13.0)) --abs(1 - ( pCont.particleAge / pCont.particleLifespan))
--format"particle age / life = %\n"abs(1 - ( pCont.particleAge / 10))
)
)
on Release pCont do
(
)
thx.
p.s. a box3 solution is fine by me, i hate scripting.
I have a script operator that is positioning particles based on data stored in the multiple custom data channels and a deforming mesh surface. It modifies the particle speed and spin to keep them aligned and positioned relative to a mesh surface.
I'm running into two issues when I render.
First, if I try to render without using the cache operator max crashes after one frame.
Second, if I do render using the cache operator, my mesh surface disppears after a few frames.
I do have the particle toolbox #1 but I'd rather not use the lock-bond as I want to extend the script operator to align the particles based on the UV tangents.
any idea what might be causing the instability?
Is there a safer way to evaluate the deforming mesh surface at the current particle container eval time?
thanks,
Jared
Lead Cinematics Tech
Blizzard
i am very puzzled in regards to calculating the length of
a stored vector minus its present position to create a multiplier
for external objects (in this case the falloff paramter of
1000 pFLow controlled lights.
and then reading this during a find target test,
Let's say you have a Position Object starting with no speeds
rotates, or forces.
You would read the vector in with
...
if (pCont.particleNew) then
(
pCont.particleVector=pCont.particlePosition
)
.....
simple enough the Vector co-ordinates of each particle would equal
the Position with a theoretical displacement of 0.
So, after writing the Vector, you then send all the particles out to
their init position with say
....
pCont.particlePosition+=pCont.randSpherePoint()*500
...
this would offset all the particles away from the stored vector points
Next you set up a Find Target by Age 60f, find target by Vector,
Event Timing.
So all the displaced particles rush to their "home position" over 60
frames offset by Event Age.
all this is fine and dandy; the weird thing is when I read the
length of the Position verses the Vector...
with say
....
TheLength=length(pCont.particlePosition-pCont.particleVector)
....
the odd thing is that the length increases as each particle heads towards
its find position; now wouldn't the displacement of each particle =0
when the displaced particles had "found their target"
shouldn't the length of the vector=0?????
..I hope this message makes sense!
I'm probably not going to use this approach now but anywa, for the record as it were....
What parameter is it that determines when a particle is going to die? I guess it gets set when a particle first encounters a delete operator as this value (or proportion left until death) is needed to determine what % of the particle age map value should be used.
So, what is this paramater, how can we read its value and also can we set its value so we can control dynamic maps explicitly?
Cheers
Chris Thomas
I have a scene with paired helices and I'm trying to fill the 'gap' between them with particles. The helices have a pathDeform so I'm using a .mesh.
I have a script that can generate points at the correct positions but when i translate that script to pflow, it doesn't seem to be using the correct coordinate space.
scene
http://www.khye.com/box3/pflow_helixfiller_problem.max
working helper script
http://www.khye.com/box3/helixFiller.ms
Khye
Right now I need to manually set my particles Material Index. I also need to find out those values before making a decision in my script. I can see there is a channel, and I can set the values of that channel using 3 methods, but I don't see any corresponding GET methods. Am I missing something?
Cheers
Chris Thomas
I have to simulate a large area covered with plants and grass, and I am trying to use ParticleFlow for this. Especially keeping the polygon count as reasonable as possible causes a headache, and I guess except for using the CameraCulling operator there's not much I can do without scripting (since I don't have any of the "Tool Boxes").
So, as the title might suggest I am trying to reduce the particle count with the distance from the camera. I have already tried wiring the position of a UVW-gizmo to the camera, projecting a radial gradient onto the ground geometry, and using this gradient as a "Density by Material"-map in the position operator. Unfortunately the position of all the particles (basically the "seed") changes every time the gradient's position is updated (which in case of a moving camera is every frame).
Another idea would be to animate the particle scale, depending on the camera distance, but this can't happen in a linear way, for example when I want the particle size to be constant from distance 0 till 200, and want them to change size from 100% down to 0% between distance 200 and 300.
Looking at modern games, grass-geometry (in my case single-polygon planes with appropriate textures and opacity maps) fades out in the distance, which would be my favourite way of doing this (since there's no "popping" happening). If the visibility of a particle reaches 0%, it gets deleted... BUT, when I decrease the distance again, it should get visible again, in the same place as before (but I guess this is the way a "random seed" works anyway).
So, long post, but I hope there's a way to script any of this.
hi,
i think i need a scale offset script. The scale operator always starts from the center of my geometry. I want to receive the effect of growing from the ground. Therefor i need to scale from buttom to top. Can anybody help me please?
thanks
Not being much of a scripter, I throw this one into the wind. Anone here know how to force particle along a specific mathematicaly defined course such as a spiral. http://mathworld.wolfram.com/LogarithmicSpiral.html
I want to build a system that replicates the look of a particle collision in a cloud chamber. One of the effects most characteristic is the spiraling of a particle to a point. I have no doubt that i could build n# paths to force the particles along or set up a series of attractors but what i would prefer is to have the particles naturaly move along this type trajectory with some amount of variation.
[url=http://images.google.com/imgres?imgurl=http://www.uwe.ac.uk/fas/wavelength/wave21/good2.jpg&imgrefurl=http://www.uwe.ac.uk/fas/wavelength/wave21/gooding.html&h=1021&w=1530&sz=700&tbnid=lQfM33UU7fHCPM:&tbnh=100&tbnw=150&prev=/images%3Fq%3Dbubble%2Bchamber&start=1&sa=X&oi=images&ct=image&cd=1]http://images.google.com/imgres?...cd=1[/url]
Any help would be great.
Thanks
-Michael
I've brought this up before but never got a fix for the problem, so I thought I'd try again because I'd really like to share some tools I've created, but this one bug is keeping them from working 100%.
Here's what happens, I can make a script to completely create a flow from scratch and it works fine. But as soon as I execute that same code from within an "on button pressed do" context inside of a rollout, it doesn't work. You have to manually delete the connection from the Source to the first Event and then reconnect them. After you do that everything works fine again.
To illustrate the problem, here's a sample script taken directly from the MaxScript help docs, written by Oleg (I'm assuming). All I've done is wrapped it in a funtion and then call that function from the rollout when you click the "DO IT!" button. You'll see that the first flow doesn't work until you manually reconnect the Source. But the second flow works without doing that.
Also notice that if you call the function outside of the rollout, it all works as expected with no reconnecting necessary.
Any ideas what going on here?
[code:1]
global testPFlow, testPFlow_RLT
fn testPFlow = (
-----------------
-- SCENE SETUP --
-----------------
-- Set scene animation range to 150 frames
animationRange = interval 0f 150f
-- Create Cylinder primitive
cyl=cylinder radius:44 height:44 heightsegs:5 sides:18 pos:[-60, -55, 0]
-- Create a Torus primitive
tor=torus radius1:55 radius2:20 smooth:2 pos:[135, 120, 0]
-- Create a Vortex Space Warp
vor=vortex timeOff:33 axialStrength:22 rotationStrength:33 iconSise:40 rotation:(quat -1 0 0 0) pos:[20,35,-5]
-- PF_Flow setup
pf=PF_Source Show_Logo:off Show_Emitter:off Quantity_Viewport:100 isSelected:true
-------------------------------------
-- Action List - Appending Example --
-------------------------------------
-- Disable automatic Event Encapsulation – begin editing:
ParticleFlow.BeginEdit()
a1 = RenderParticles() --define Action 1
pf.AppendAction a1 --append the Action to PF_Source
ParticleFlow.EndEdit() --End editing, enable Auto-Encapsulation
x=y=1 --Initialize two variables
--Get the location of the PF_Source in Particle View:
pf.GetPViewLocation &x &y
------------------------
-- Define First Event --
------------------------
ParticleFlow.BeginEdit() --start editing
-- Create a Birth Action for Event 1
ev1_a1 = Birth Emit_Start:0 Emit_Stop:0 Amount:300
-- Create a Position Object Action for Event 1
ev1_a2 = Position_Object Location:4 Emitter_Objects:#(tor) name: "PositionObjectFirst"
-- Comment the Position Object
pf.SetComments ev1_a2 "The operator defines the destination point inside the target volume"
-- Create a Script Operator
ev1_a3 = Script_Operator()
-- Set the script operator’s script code as string.
-- The code enables Position and Vector channels,
-- the writes the particle position in the Vector channel
-- for all new particles.
ev1_a3.proceed_script = "on ChannelsUsed pCont do
(
pCont.usePosition = true
pCont.useVector = true
)
on Init pCont do
(\n
)
on Proceed pCont do
(
count = pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
if (pCont.particleNew) then
( pCont.particleVector = pCont.particlePosition)
)
)
on Release pCont do
(\n
)"
-- Comment the action:
pf.SetComments ev1_a3 "The script is used to dump particle position to script vector channel"
-- Clone the Position_Object action from Event 1
-- The result of the cloning will be stored in the
-- by-reference variable dc.
maxOps.cloneNodes ev1_a2 newNodes:&dc
-- Get the clone (first element of array)
ev1_a4 = dc[1]
-- Set the name of the action
ev1_a4.name = "PositionObjectSecond"
-- Set the Cylinder as the Emitter
ev1_a4.Emitter_Objects = #(cyl)
-- Comment the action:
pf.SetComments ev1_a4 "The operator defines the initial position of a particle inside a start volume. The destination position is overwritten but the real value is kept in Script Vector channel"
-- Create some more actions needed to control the particle system
ev1_a5 = Speed Direction:3
ev1_a6 = Rotation()
ev1_a7 = ShapeStandard Shape:1
ev1_a8 = DisplayParticles Type:6 Color:(color 255 0 0)
-- Create a new empty event, then append all already created
-- actions to it:
ev1 = Event()
ev1.AppendAction ev1_a1
ev1.AppendAction ev1_a2
ev1.AppendAction ev1_a3
ev1.AppendAction ev1_a4
ev1.AppendAction ev1_a5
ev1.AppendAction ev1_a6
ev1.AppendAction ev1_a7
ev1.AppendAction ev1_a8
-- Disable editing, enable Auto-Event-Encapsulation
ParticleFlow.EndEdit()
-- Append the event as the Initial Action List to the PF_Source.
-- This will connect the Event to the PF_Source.
pf.appendInitialActionList ev1
-- Position the Event inside the Particle View
ev1.SetPViewLocation x (y+100)
-------------------------------------
-- Action List - Inserting Example --
-------------------------------------
--Begin Editing again
ParticleFlow.BeginEdit()
ev1_a9 = Spin SpinRate:200 Variation:55 --Create a Spin action
ev1_a10 = Force Influence:111 --Create a Force
--Set the Vortex as Space Warp in the Force
ev1_a10.Force_Space_Warps = #(vor)
--Create and setup a Find_Target action:
ev1_a11 = Find_Target()
ev1_a11.name = "FindTarget"
ev1_a11.Cruise_Speed_Variation = 1000
ev1_a11.Acceleration_Limit=3000
ev1_a11.Aim_Point_Type = 2
ev1_a11.Icon_Size = 0
-- Comment the action:
pf.SetComments ev1_a11 "The destination point is defined by script vector. The script vector value was defined by the Script Operator 01 from the Position Object 01"
-- Insert the new actions into the existing Event
ev1.InsertAction ev1_a9 8
ev1.InsertAction ev1_a10 9
ev1.InsertAction ev1_a11 10
ParticleFlow.EndEdit()
-- Create a Second Event and its actions:
ParticleFlow.BeginEdit()
ev2_a1 = Speed Speed:0
ev2 = Event()
ev2_a2 = DisplayParticles Type:6 Color:(color 0 255 0)
ev2.AppendAction ev2_a1
ev2.AppendAction ev2_a2
ParticleFlow.EndEdit()
--Connect the second Event to the Find_Target
ev1_a11.setNextActionList ev2 ev1_a11
--Reposition the even
ev2.SetPViewLocation x (y+400)
-- Make copy of PF_Source and exchange Emitter objects
-- for Position_Object operators:
-- Clone the PF_Source and the two Emitters,
-- store the clones in a by-reference variable
maxOps.CloneNodes #(pf, ev1, ev2) newNodes:&dc
-- Get the PF_Source and Emitter clones
pfc = dc[1]
ev1c = dc[2]
ev2c = dc[3]
-- Get the current position of the Particle View...
x=y=1
pfc.GetPViewLocation &x &y
-- Reposition the two Events
ev1c.SetPViewLocation x (y+100)
ev2c.SetPViewLocation x (y+400)
-- Copy the emitter objects from the original Position_Objects
if $PositionObjectFirst01 != undefined then (
$PositionObjectFirst01.Emitter_Objects = ev1_a4.Emitter_Objects
)
if $PositionObjectSecond01 != undefined then (
$PositionObjectSecond01.Emitter_Objects = ev1_a2.Emitter_Objects
)
-- Bind the Find_Target Test output to the clone of the Second Event
if $FindTarget01 != undefined then (
$FindTarget01.setNextActionList ev2c $FindTarget01
)
-- Switch to Modify Tab
max modify mode
-- Open Particle View to see what happened...
ParticleFlow.OpenParticleView()
)
try (destroyDialog testPFlow_RLT)catch()
rollout testPFlow_RLT "Test PFlow" (
button doIt_BTN "DO IT!"
on doIt_BTN pressed do testPFlow()
)
createDialog testPFlow_RLT pos:[40,80]
-- run function without using the dialog button
-- testPFlow()[/code:1]
Hi,
I'm having a little trouble with a script.
I need to access user defined data from the pfsource object that the particles emmited from. How do I get a handle on the emmiter object that those particles emitted from. Once I have that I should have no problem getting at the user defined data and the emmiters transform.
Any help would be greatly apreciated.
Thanks
FxMonkey
Hi,
I am trying to make some leaves follow a branch, and after having tried scatter inside max I thought PFlow might be more usable.
Here's a picture to illustrate what I want:
[img]http://www.superrune.com/offsite/2006/flow_orient.jpg[/img]
Thanks to the Speed By Surface operator, the leaves follow my branch object. But I would like them to only follow the branch along one axis (the Z axis, downward). Is there a way I can reset the other two axes and keep them aligned to the world. Maybe by scripting something like this:
particle.orientation.x = 0 + (random value from -10 to 10)
particle.orientation.y = 0 + (random value from -10 to 10)
particle.orientation.z = original + (random value from -10 to 10)
And if this is possible without matrices (which I don't understand), I'd be very happy! Does anyone know if this could be done through scripting, and how the script should be?
Thanks,
Rune
I've been having trouble with some Pflow scripted operators and tests, and it was recommended I come here to ask you guys! Seems I came to the right place...
I have a pflow system set up to detect the nearness of an emitter to the ground plane, and when the distance is too far, the particles are sent to another event to be deleted. I have a few other scripted operators throughout the system that take absolute value of particleSpeed vectors so that they always head in an upwards direction. These all work fine and dandy in the viewport, and even when I render locally I get exactly what I expect. I have a viewport/render cache that saves with the file, at a very light 4 mb.
The problem arises when I send the files to the render farm. All the render nodes have the exact same software as my local machine, but upon submission all of the netrendering services crash, and have to be restarted. Other pflow system work just fine (ones that don't have scripted events etc), so I'm thinking its in my scripts. Since the absolute value script operators I made are so simple, I don't think it could be them. It should be in the distance checking. I use intersectRay to check collision and distance of the ray to the groundplane. The groundplane is stored in a custom attribute of the whole particle system, accessed like so:
[code:1]
on ChannelsUsed pCont do
(
pCont.usePosition = true
pCont.useSpeed = true
)
on Init pCont do
(
)
on Proceed pCont do
(
theGround = (pCont.getParticleSystemNode()).footStore.groundPlane
count = pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
theSpeed = length (pCont.getParticleSpeed i)
thePos = pCont.getParticlePosition i
theRay = intersectRay theGround (ray thePos [0,0,-1])
if theRay != undefined do
(
if distance thePos theRay.pos > .15 or theSpeed < .01 do --speed cleanup
pCont.particleTestStatus = true
)
)
)
on Release pCont do
(
)
[/code:1]
Is the problem that when the render nodes open the file they are trying to run PFlow prior to accessing the footStore.groundPlane node in the system? I can't think of anything else it could be... please help if you can! Much appreciated
Hi again,
I've another little problem with my particles.
A character walk on the ground, and each of his step creates a particle Facing, on which I put an animated 2D texture simulating a mud splash.
The problem is : I have 5 different animations to put on the faces, but how can I let 3dsmax decide to put one of these 5 textures at random ?
I think this time I need a script, don't you know ?
Thanks in advance.
Hello again,
I need your help a second time to create a "breath effect".
I put a particle view system on a character's mouth in order to simulate breathing. Therefore I need a tip to slow down my particles at the end of their life, stop the birth for few frames, then redo the same continually.
I thought it was possible with a Drag Space Warp but it could be more simple with a script, no ?
And how could I stop the birth for few frames ? With a birth script or simply send my old particles to a next event spawning invisible particles ?
In this case, how can I make a loop to avoid creating 100 or more events ?
Thanks in advance.
Hello,
I'm doing a trailer for a videogame in which a character lets footprints on the ground. Animation is very long, that's why I decided to use Particle Flow.
I've put a particle system on each foot, linked to the correct bone. Now I want to create One Particle on each system, testing collision with the ground, and when the particle collides, it turns into a nice shape mark :
[url=http://upload4.postimage.org/379330/photo_hosting.html][img]http://upload4.postimage.org/379330/Pview01.jpg[/img][/url]
The birth isn't good of course.
The problem is when the particle collides, I need a new one to be created because if not, no new footprint can be done.
So could you help me do write a little Birth Script which creates a particle each time the last one dies or is sent to another Event ?
Thanks you
Laurent.
Is this possible
In a birth script where the shape is called via say
pCont.particleShape = WUZZLE[i].mesh
this sets up a global for the rest of the scene where
this is the default shape.
So lets say
event birth=birth shape
event 1 =birth shape
event 2=shape plus square
event 3=back to original birth shape
is it possible via scripting somewhere to store
the origlnal birth script shape and then have the
script call back this shape;
or would the shape plus operator overwrite
all the downstream events
since this (mesh) can't be defined in a vector for
storage, could it be defined in a matrix maybe?
I have tried storing the shape in the birth scriptr for later
retrieval with say
CurShape=pCont.getParticleShapebyID CurID
but when I call it back three events later I get
errors, as most likely
a) the ID has changed
b) I don't know what I'm doing!
thanks
I've looked and so far I can only see a way to delete particles by their index. I'm sure there is a way of scanning through all the particles and comparing their ID with the ID you wish to delete, but in this case explicitly specifying the ID for deletion would be a lot easier for me. Possible?
Cheers
Chris Thomas
simple question:
how to refresh PF after using:
$'Event name'.activate true
?
thanks,
-cpb
Chris's recent post reminded me of an issue i had a while ago. I had 10+ events, each with a script operator. When I would get a bad script and it would break. Even turning off/on the Render event wouldn't reevaluate them to fix it. I ahd to go through and open/close each script operator to get them all back online. Is there anyway we could get a freebie or something that went through and automatically updated/evaluated all script operators?
Khye
Hi Oleg, I'm having some major issue here using the Final Step Update script. Could you please give some help, its the first time I've used it in anger, and there are some things about it that seem voodoo compared to the standard Pflow Script ops in events
1. When I evaluate the script it does not seem to do it correctly. I think it evaluates ok, but it will not actually execute the current version of the script you just evaluated until you close the script editor window for the script. Its making developing a script a mare. Any tips?
2. In the example script there is no sign of the usual channel declataion at the head of the script. Does this mean that the particle channels cannot be accessed, or that there is another way to activate them. I have tried without success, and until I do my system is effectively knackered as a LOT of data is stored in those channels and is needed in this script, per particle.
3. As this is not an Event, I note that the .particleNew property does not work. Makes sense I suppose.
So, to makes sure I'm using the best approach let me exaplain what I am doing here.
In Event1 I spawn a single paricle, it travels through space, spawning children into Event2. I store the parents ID in its integer channel, the children all inherit it.
In Event2 I measure the distances between each spawned particle and their directions to each other. I then align them so they can form a line with their meshes, and scale them so that a mesh with a length of 1 will form an unbroken line from one particle to the next.
In Event3 I create some random numbers, angles and seeds and store these in each particles Vector channel.
Then in the FINAL STEP UPDATE script I grab these stored values per particle, apply them to scene meshes modifers and then grab that mesh an apply it to the particles SHAPE channel. Except...... it does not work, because I cannot seem to be able to access the vector, matrix, integer etc channels from here.
Please help :(
Cheers
Chris Thomas
Hi, is there a way to only execute part of a script only at the end of a frames interval? I am defining a mesh in a scene via a Pflow script tweaking its various modifiers. Then I copy that objects mesh to my particles SHAPE property via my script. The problem is that this is happening during sub-frames as I have my int step set to 8th of frames. This low int step is needed earlier in my Flow, but for the Mesh stage of the flow a per frame script execution would be much more efficient.
What I want to do really is to have that mesh definition and copy take place on the last int step before the end of the frame. So that on the next frame interval the mesh is updated, but so that I am not doing this slow mesh manipulation and copy to my particles over and over during sub-frames that cannot be seen.
So, is there a method for this?
Cheers
Chris Thomas
Hi,
I am having trouble with the IMXParticleContainer::GetParticleSystemNode() function that I would like to use within a script controller.
If I have only one system it works ok. If I have 2 systems with 1 event (birth event) each it's still ok.
It goes wrong when I have 2 systems with 2 events. The return value of the function can be the wrong node. As in: the script called in system 1 obtains the node of system 2.
I have a very simple test file to demonstrate it that I can forward if that helps.
Thanks,
Rog.
Rogier Fransen
Monkeylab
work: www.monkeylab.com.au
home: www.rogierfransen.com.au
The particleIndex as I understand it is a way of addressing each particle in the current event. The standard way off addressing them is working out the event count, and then stepping through that number with a loop and using the current loop iteration as the current Index number. In that way all addressable particles in the event get their turn.
However, if I have a list of particles stored, say by their particleID's, what is the best way to set the index to address these? My list of IDs may be say...
2,8,22,100,4,2,8,9,12 etc
Lets say this event had only these particles in it, there is a count of 9. I normally could just step through the Index from 1 to 9, but lets say I have 2 lists like...
2,3,8,12,5
99,13,4
Now I only want to adjust the second list of 3 paricles. How can I set the Index value so it correspondes to the particle with the same ID. Do I have to use an loop to create a correspondance list first, an array of IDs compared to Index numbers. Or is there a built in way to do this. So I can simply say particleIndex = particleID, or something along those lines?
Cheers
Chris Thomas
Hi all,
thanks for reading first of all.
I need a preset or script to mimic a sparkle effect of a fuse - like the one of Mission Impossible...
I tried many things but it still doesn't look real enough...
Does anybody has a script or preset for that?
Please let me know
Many Thanks
Best Regards
Andreas
A quick question, I have a seed particle that is spawning new particles into a second event. Is there a way to associate the spawned particles with the one that spawned them? I need to be able to do this so that I can put the spawned particles from each seed into their own "family". This family of spawned particles will then be animated in a certain way, so its important that particles spawned from one seed are not mixed up with particles from another.
The only way I can think of doing this at the moment is by having the original particle spin in event one with a random value, and then use that spin rate or axis in event 2 as a unique identifier. I assume spawned particles inherit their parents spin? If this does not work, I'll have to find another method.
So, the question is, what can I use to tell a spawned particle came from a particular parent, what does the spawned particle inherit that will allow me to do this?
Cheers
Chris Thomas
I drop down a PF Source icon, open Particle View, and put a Script Operator under the default speed icon.
I change the Birth: Emit Start to frame 10
I set the script for the script operator to:
[code:1]
on ChannelsUsed pCont do
(
pCont.useSpeed = true
)
on Init pCont do ()
on Proceed pCont do
(
count = pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
format "%: %\n" i pCont.particleSpeed
)
)
on Release pCont do ()
[/code:1]
Why do all the particle speeds print out as 0?
is there a script equivalent to "Restrict Divergence to Axis"
(found in the Rotate Operator) that can be applied to scripts
with pCont.particleOrientation in the script body?
thanks
If I create a plugin in maxscript and then have the plugin create a PF_Source object, it wont display any particles in the viewport or render until I open up a particle view window, delete and reattach the line connecting the very first event to the render box.
Any way around this?
[code:1]
plugin Helper ProblemIllustrator
name:"make PF_S"
classID:#(0x51e3b744, 0x2b070978)
category:"Custom"
extends:Dummy
(
local pfs
parameters main rollout:params
(
)
rollout params "Parameters"
(
button btnCreate "Create system"
on btnCreate pressed do
(
--copied from the listener
this.pfs = PF_Source X_Coord:220 Y_Coord:0 isSelected:on Logo_Size:30 Emitter_Length:40 Emitter_Width:40 Emitter_Height:0.01
particleFlow.BeginEdit()
op1 = Birth()
op2 = Position_Icon()
op3 = Speed()
op4 = Rotation()
op5 = ShapeStandard()
op6 = RenderParticles()
op7 = DisplayParticles()
op7.color = pfs.wireColor
ev1 = Event()
ev1.SetPViewLocation (pfs.X_Coord) (pfs.Y_Coord+100)
particleFlow.EndEdit()
ev1.AppendAction op1
ev1.AppendAction op2
ev1.AppendAction op3
ev1.AppendAction op4
ev1.AppendAction op5
ev1.AppendAction op7
pfs.AppendAction op6
pfs.AppendInitialActionList ev1
pfs.Show_Logo = on
pfs.Show_Emitter = on
)
)
)
[/code:1]
I used your bullet time effect script and changed it for my needs. With a dummy object I controll the speed of the particles to slow them down or speed them up. In viewport all is fine, but when I render, the script is ignored.
[code:1]on ChannelsUsed pCont do
(
pCont.useTime = true
--pCont.useAge = true
)
on Init pCont do ()
on Proceed pCont do
(
count = pCont.NumParticles()
tEnd = pCont.getTimeEnd()
for i in 1 to count do
(
pCont.particleIndex = i
--ageIncrease = tEnd - pCont.particleTime
--pCont.particleAge = pCont.particleAge - ageIncrease
pCont.particleTime = tEnd-($_PFlow_DummySpeed.speed)/100
)
)
on Release pCont do ()[/code:1]
Dear Oleg & everybody who reads this,
i have the following problem: i made a simulation with reactor with shapes some shapes i made in illustrator. now i want to do some tricks wih particle flow and for that i want that every shape gets one particle assigned, that displays the same geometry as the original shape.
so far, i made this birth script:
[code:1]
on ChannelsUsed pCont do
(
pCont.useTM=true
pCont.useShape = true
)
on Init pCont do
(
global EmmiterArray = $shape* as array
)
on Proceed pCont do
(
if (currentTime==0f) do (
for i in 1 to EmmiterArray.count do
(
pCont.AddParticle()
pCont.particleIndex = pCont.NumParticles()
pCont.particleTM= EmmiterArray[i].transform
pCont.particleShape = EmmiterArray[i].mesh
)
)
)
on Release pCont do ()
[/code:1]
this works well with all kinds of basic shapes like boxes etc, but with the imported shapes i have the problem that the particles don't align.
1st thing i have to do with all the things imported from illustrator is to reset the pivot. then the particles are in exact the same position with the underlying shape.
My big problem is now that i already set up a scene with more that 400 shapes, that are linked to proxies that are less complex for the animation in reactor, and that i SCALED the imported shapes of illustrator.
and here it goes wrong. as soon as i scale them, the particleTM doesn't regognise that and the particles are as small as the original imported shape. What am i missing here?
i tried to adjust the particle scale with pCont.particleScale but that didn't really work out.
any tip?
thank you!
Its been a while since I've scripted pflow. Memmory may be playing tricks on me but.... Is there access to the particle Spin Rate via scripting?
Cheers
Hello,
i have a scene where i lock particles onto some delegates of a crowd simulation. For that i use a script operator.
The problem is, when i hit play in the viewport they all move fine, but when i render the particles stay at the same spot and don't move with the delegates.
I thought i could solve it with the viewport cache, but doesn't work either.
Thanks for any help!
here's my script:
[code:1]
on ChannelsUsed pCont do
(
pCont.useTime = true
pCont.usePosition = true
pCont.useTM=true
)
on Init pCont do
(
)
on Proceed pCont do
(
count = pCont.NumParticles()
x=1
for i = 1 to 11 do
(
pCont.particleIndex = i
if x<10 then j="0"+x as string else j=x as string
objName = "Delegate"+j as string
objPath = execute ("$'"+objName + "'")
pCont.particlePosition = objPath.position
pCont.particleTM = objPath.transform
x=x+1
)
)
on Release pCont do ( )
[/code:1]
[url=http://upload4.postimage.org/95414/photo_hosting.html][img]http://upload4.postimage.org/95414/SCREENSHOT_0014.jpg[/img][/url]
So evidently you do have to declare variables as global in the Init to access them in proceed.
Say I'm defining an array per event with a handful of arrays. Then in a different pflow I want to access all of those arrays. The problem is that sometimes I want to keep some of those events that define not to calculate particles . . .
so
1) What is the order in which events are processed? How can I be sure Event 2 that defines an array will be evaluated and thus global array create besure Event 5 evaluates and ties to access said array.
2) Is this a time when I should create all arrays using an every step script?
khye
if you declare variables in the init context, will they be seen in the Proceed context without a global context?
Khye
Hi, I have a Particle Flow with gravity and a floor deflector. my particle walk on all floor (on x and y axis) and, when they self collide with a keep apart operator, I want they make a little bounce on z axis. I think I must use a script operator. how can I do this?
is there anyway to access the particle ID's by scripting?
i want to birth a sequencual particles from a spline.
so i don't want them to come out of random points at the same time.
this is rather easy to do in Houdini, because of the point attributes.. just curious if i could do something like this in PFlow
I have a scene which particles are going to each vertex on a cylinder, which works fine.
The trick is that instead of each ring being created and then moving on to the next ring, I want to build two rings simultaneous, move on to the next two rows. . .
I've done this with the script:
on Proceed pCont do
[code:1](
count = pCont.NumParticles()
k = 0
for i in 1 to count do
(
pCont.particleIndex = i
if mod i 2 != 0 then k+=18 else k-=17
--because there are 18 vertices in 1 ring.
if pCont.particleNew do
(
pCont.particleInteger = k
pCont.particleVector = vertexArray[k]
)
)
)[/code:1]
It starts to fail when particles are sent to the next event. I can't seem to figure out how to keep it going throughout the timeline.
Here's the scene: [url]www.khye.com/max/FindVertex.max[/url]
Khye
I'm using vectors for a find target operator. The vectors are changing each frame, but they're still going to the initial vectors. Is there a way to update this target vector data?
Khye
Don't know if this is what I'm looking for. Is the Material Index the index in the material editor or the # of sub-material number?
Can anyone show an example using this?
Khye
Hi guys,
I really can't see why this doesn't seem to work :
Does anyone see what I am not seeing?
[code:1]
(
-- select a freshly created PF system
pf = $
-- Go into pf subobject or use following line :
-- max modify mode; subobjectlevel = 1
pf.particleindex = 1
pf.particleselected = true
-- Neither of those seem to work :
print (pf.particleSelected) -- returns false??
print (pf.getParticleSelected 1) -- also returns false
)
[/code:1]
Thanks a lot!
Tom
Hi, Oleg. I'm the guy who had a question about the "memory leak" in PF causing progessive slowing of the render. I think I've found a workaround (using an operator that I downloaded from this site, in fact), but I'd still like to know where I screwed up so I won't make the same mistake again. Here's the birthscript that you spotted a problem with, so maybe others reading can benefit from your sage advice, too:
[code:1]
on ChannelsUsed pCont do
(
pCont.usePosition = true
)
on Init pCont do
(
)
on Proceed pCont do
(
big_string = #([7,4912,-4], [-1,4711,283], [23,-4703,-149], ... *(deleted for space)*...[-10349,-888,-448], [-10852,357,78], [-12159,6571,3])
print heapFree
for n = 1 to big_string.count do
(
pCont.AddParticle()
pCont.particleIndex = n
pCont.particlePosition = big_string[n]
)
)
on Release pCont do ( )
[/code:1]
What did I miss? Thanks for your help!
Trent
hi all. i am a current cg student and we havnt learnt scripting yet but i was wondering if anyone could help me out with a script for particle flow.
basically what i have is a character with particles all over him that spawn other particles at 2 different rates based on how fast they are moving at any given moment and a sort of in-between rate for a few frames to "soften" the change from fast to slow. the particles that spawn others must also stay locked to the character in that event.
the ratio of speed to spawn rate is simple. particle speed (in cemtimetres) / 2 = spawn rate. also the min / max values of the spawn rate are 10 & 100 respectively so i figured you'd hav somethin like:
"if spawn rate is less that 10 then rate = 10"
and for the max value
"if spawn rate is greater than 100 then rate = 100"
my current flow is as follows:
[i]<the link is broken>[/i]
as i hav said we havnt covered scripting yet in my course but the idea seems fairly straight forward. any feedback anyone can give me would be greatly appreciated
Is there a way to use the Find target with script vector to find back to both the scripted position and rotation?
Ive fragmented an object and want to make it come back together after the pieces have been flying around for a bit.
I know how to get the pieces back to the original position but i cant seem to get the rotation right.
Thanks in advance
/arvid
I came up with a pflow birth script that takes a bitmap image and creates one particle per pixel in the image. You can then do whatever you want with the flow to make it blow away or whatever you can think of.
The scene is Max 8. It uses a birth script and another script operator to keep the overall size of the particle image at 100 units across so you can start with a low res bitmap, set up the flow, and then substute a high res version of the same picture for rendering, since things can really slow down if the bitmap is more than a couple hundred pixels on a side.
When you open the file you'll get a missing bitmap error. Just replace the missing image with whatever you want. The script looks at the diffuse slot of the first material in the Material Editor. So replace it there.
Have fun.
[url]http://jhaywood.com/stuff/picToParticles.zip[/url]
Here's a quick sample movie...
[url]http://jhaywood.com/stuff/picToParticles_sample.mov[/url]
I am currently fooling about with this script from a tutorial
[quote]on ChannelsUsed pCont do
(
pcont.useposition = true
)
on Init pCont do
(
)
on Proceed pCont do
(
count = pCont.NumParticles()
Global PRB = $sphere* as array
if currenttime >= 0 then PRB.position = [0,0,0]
for i in 1 to count do
(
pCont.particleIndex = i
PRB[i].position = pcont.particleposition
)
)
on Release pCont do
(
) [/quote]
what I can't figure out is how to make the sphere objects inherit the rotation from the particles. can anyone help me out?
also does anyone know I could make an interface that would pop up when I integrate this script into the Pflow script operator so that I could make a number of copies from a picked object and then have a button that would run this script
[quote]animate on
for i = 1 to 150 do
(
slidertime = i
$sphere01.position = $sphere01.position
)
[/quote]
I am guessing that this one would need the rotation changes as well
any help would be enormously appreciated!!
Hello,
I've got a birth script that creates 1 particle for every face in a source object. In addition, it orients the particle to the face normal. This all seems to be working correctly, but when scrubbing the time slider, the particles sometimes don't show up, or disappear. If I try to scrub the time slider backwards, they always disappear.
Does anything look wrong with this script that would keep particles from showing up in the viewport ?
[size=9]
[color=blue][b]on ChannelsUsed pCont do[/b] (
pCont.useTime = true
pCont.useAge = true
pCont.useTM = true
)
[b]on Init pCont do[/b] (
global birthTime = 145[/color] [color=green]--what frame the particles will first appear[/color][color=blue]
global birthShape = $BirthShape_01 [/color][color=green]--an object such as a geosphere converted to an editable poly[/color][color=blue]
)
[b]on Proceed pCont do[/b] (
if (currentTime == 145f) do (
for x = 1 to birthShape.numFaces do (
pCont.addParticle()
pCont.particleIndex = pCont.NumParticles()
pCont.particleTime = birthTime/160
pCont.particleAge = 0
pCont.particleTM = matrixFromNormal (polyop.getFaceNormal birthShape x)*birthshape.transform
)
)
)
[b]on Release pCont do[/b] ( )[/color]
[/size]
Max8 Scene File Here: [url]www.dahlinger4.com/pflow_help/pflow_birthScript_01.max[/url]
[size=9](note: this scene also contains a script op to give the particles speed in the direction of the face normals.)[/size]
Thanks!
Bill
(direct3d viewport)
Hi again,
I have used Allan Mckays fracture example as my starting point and created a birth script. It works great if I leave the display set to anything other then geomotry. When I change it to geomotry the pieces are not rotated into place and some of them do not even show up.
My question is how do I get the particles to be rotated properlly into position so they align exactly with the mesh pieces?
I have enclosed the birthscript.
on ChannelsUsed pCont do
(
pcont.useposition = true
pcont.useshape = true
)
on Init pCont do
(
global groundGeom = $Box_* as array
)
on Proceed pCont do
(
t1 = pCont.getTimeStart() as float
t2 = pCont.getTimeEnd() as float
if ((t1 <= 0) and (t2 >= 0)) then
(
(
pcont.addparticles groundGeom.count
for i in 1 to groundGeom.count do
(
pcont.particleindex = i
pcont.particleshape = groundGeom[i].mesh
pcont.particleposition = groundGeom[i].position
)
)
)
)
on Release pCont do
(
)
Thank you all for your time and help.
Regards
Alex
One of the choices in the Group Select operator
is "Script Float", and I was wondering what
an effective example of this would be?
Would this be reading the float value from a
script op in order to create the Selection of Particles?
Thanks
Hi there ...
really hope someone can help out .
In my flow i am spawning children particles in rings around each parent particle. The children are holding their parents ID's in their Integer variable as per the technique outlined in the thread in this forum.
I am using the integer value in a downstream event to access the parents current position in space. i use this to determine the distance between child and parent . i want to use this "radius" to control the scale of the child particle. simple enough right ?
i am using the call
parentID = pCont.particleInteger
pCont.getParticlePositionByID parentID
to access each childs parents position
the problem is that max sometimes isnt picking up the parentID when it is suposed to ??
here is a screen shot of the flow and each script in each event.
sorry i cant provide link to the max file ... (no webserver access here) .. oh .. i cant upload img either can i. DOH. damn i need to get access .. would be sooo much easier to provide the max file.
anyway ...
its more simple than it looks
my first event is
BIRTH
POSITION
SPEED
SHAPE
SCRIPT Op
Send Out (all)
Display
2nd Event
SCRIPT Op
SCRIPT TEST
Display
3rd Event
SHAPE
SCRIPT OP
Display
here are the script Ops in sequence ....
i hope this isnt too much to wade thru for guru's ...
im really stumped as to why it fails just on certain ID's and not others.
even though the parent id is correct , the return from
getParticlePositionById is returning the wrong particles position... ??
can anyone shed some light???
thanks in advance ...
b
[code:1]
on ChannelsUsed pCont do
(
pCont.useInteger = true
pCont.useSpeed = true
pCont.useScale = true
)
on Init pCont do
(
)
on Proceed pCont do
(
--------------------------------------------------------------------------------------------------------
-- INITIALISE Vars
CurScaleXYZ = [1,1,1] -- set the default current scale
CurScale = 1.0 -- set the default current scale
parentSF = 10 -- scale factor for initial parent size
pf = $'PF_Column' -- set a variable to reference this whole particle system
-- set up initial ID's and speeds
count = pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
if (pCont.particleNew) then
(
-- set particle ID's to Integer chanel
pCont.particleInteger = pCont.particleID
-- initialise the scale of the particle
pCont.particleScaleXYZ = CurScaleXYZ
pCont.particleScale = CurScale
thisVel = pCont.particleSpeed
thisID = pCont.particleID
-- set the scale based on speed
-- old --- pCont.particleScale = CurScale * length thisVel * 20
parentScale = CurScale * 1/(length thisVel*4800) * parentSF
pf.setParticleScaleByID thisID parentScale -- set scale by reference to ID
)
)
)
on Release pCont do
(
)
[/code:1]
then in next event
[code:1]
on ChannelsUsed pCont do
(
pCont.useInteger = true
pCont.useFloat = true
pCont.useVector = true
pCont.usePosition = true
pCont.useTime = true
pCont.useSpeed = true
pCont.useOrientation = true
pCont.useSpin = true
pCont.useScale = true
pCont.useAge = true
)
on Init pCont do
(
)
on Proceed pCont do
(
--********************************************************************************************************
-- INITIALISE VARS
numSpawn = 12 -- number of particles we want to make in the ring
totLife = 800 -- total Lifetime of Particle Growing --- in frames
circRad = 20 -- radus of circle for spawning particles
ringSpeedFact = 1 -- mult factor of parent speed
CurScaleXYZ = [1,1,1] -- set the default current scale
CurScale = 1.0 -- set the default current scale
pf = $'PF_Column' -- set a variable to reference this whole particle system
parentSF = 10 -- multiplier for parent scaleFactor
expandSF = 0.00002 -- scale Factor for velocity expansion rate of rings
--********************************************************************************************************
count = pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
if (pCont.particleNew) then
(
-- get parent current position from parent ID stored in integer user var
parentID = pCont.particleInteger
pCont.particleIndex = parentID -- temp set the current particle index to the parent ID
--thisIndex = pCont.GetParticleIndexByID parentID -- get the particle index of the parent
--pCont.particleIndex = thisIndex -- temp set the current particle index to the parent ID
parentPos = pCont.GetParticlePositionByID parentID -- get the current position of the parent particle
parentVel = pCont.GetParticleSpeedByID parentID -- get the current velocity of the parent particle
-- set the parent float value so it tests in the script test operator to fail (ie , stays in this event)
pCont.particleFloat = 0
pCont.particleVector = parentVel
--********************************************************************************************************
--- RING BUILD
-- spawn new particles in a circle about the parents location
inc = 360/numSpawn -- get increment for circle calc
circRad = circRad * 1/(parentVel.z*4800) *50 * random 0.8 1.3
----------------------------------------------------------------------------------------------------------
-- PARENT SCALE ---- based on the parent velocity
parentScale = CurScale * 1/(length parentVel*4800) * parentSF
pf.setParticleScaleByID parentID parentScale -- set scale by reference to ID
----------------------------------
-- make the ring children
for j in 1 to numSpawn do
(
pCont.addParticle() -- add a new particle to the system
pCont.particleIndex = pCont.NumParticles() -- set the index to this newly made particle
pCont.particleInteger = copy parentID -- set this childs integer val to remember its parents ID
-- set position of each particle to be in a circle about the parent position
pCont.particlePosition.x = parentPos.x + (circRad*cos(inc*j))
pCont.particlePosition.y = parentPos.y + (circRad*sin(inc*j))
pCont.particlePosition.z = parentPos.z
-- set the velocity of the ring to be a factor of the parents velocity
pCont.particleSpeed = parentVel * ringSpeedFact
--------------------------------------------------------------------------------------
-- set scale of particles to be relative to the ring radius
CurId = pCont.particleID -- get the ID of this child
pCont.particleScale = CurScale * circRad/50
--------------------------------------------------------------------------------------
-- set test switch to true to send these new particles to the "children" event
pCont.particleFloat = 1
--------------------------------------------------------------------------------------
-- DEBUG
--ppos = pCont.particlePosition
--pCont.particleVector = CurScaleXYZ
--pCont.particleFloat = CurScale
)
)
)
)
on Release pCont do
(
)
[/code:1]
then i test with a script test and send the children to another event which has this script operator
[code:1]
on ChannelsUsed pCont do
(
pCont.useInteger = true
pCont.useFloat = true
pCont.useVector = true
pCont.usePosition = true
pCont.useTime = true
pCont.useSpeed = true
pCont.useOrientation = true
pCont.useSpin = true
pCont.useScale = true
pCont.useAge = true
)
on Init pCont do
(
)
on Proceed pCont do
(
count = pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
-- print "index"
--print pCont.particleIndex
----------------------------------------------------------------------------------------------
-- PARENT INFO
-- get parent ID of this child (stored in integer user var)
parentID = pCont.particleInteger
--print "parentID"
--print parentID
parentPos = pCont.GetParticlePositionByID parentID -- get the current position of the parent particle
parentVel = pCont.GetParticleSpeedByID parentID -- get the current velocity of the parent particle
----------------------------------------------------------------------------------------------
-- ******************************************************************************************
-- Set Particle Ring Child Size relative to the Radius distance to its parent Particle
thisID = pCont.particleID
--thisPos = pCont.particlePosition
thisPos = pCont.GetparticlePositionByID thisID
--print "thisPos"
--print thisPos
--print "parentPos" ; print parentPos
vectRad = parentPos - thisPos
--print vectRad
--print "vectRad"
rad = length vectRad
--rad = length pCont.particleVector
--print rad
--print "rad "
pCont.particleScale = rad/100
)
--print
--print " *************************************"
--print
)
on Release pCont do
(
)
[/code:1]
[/code]
I was quite shocked when reading about
how to expose the turbulence parameter
in a wind that this 3D funtion is controlled
by a float value!!!!
The reason this matters to me is this
In a script op I am controlling a wind with
no force but turbulence only with a simple
line such as pCont.particleFloat=pCont.particleAge.
So this is great, the turbulence increases as the
particle ages as expected, but usually I create my
animations plan to the camera, with a matte object
that is uses for shadow creation, that sits right
at 0,0,0.
So, if any particles pass into the realm of positive y
(or any object) for the matter, it will be occluded
by the matte box, and Poof, it is gone forever.
Now for particles this is easy to control with a line
such as
...
CurID=pCont.particleID
CurPos=pCont.getParticlePositionByID CurID
if CurPos.y>0 then CurPos.y*=-1
pCont.particlePosition=CurPos
...
But when you add control over turbulence with the
script wiring, you have no control over the direction
as it is a float value! (It should be a vector)
So even if you brought the wind (lets call it $ForceWind
in the script) you can not define its X,Y,Z co-ordinates
in MaxScript as it is a float value.
Lets say in the INIT are you...
GLOBAL CurTurb=$ForceWind
and in the proceeds you...
NewTurb=CurTurb.turbulence
(it is all legal in maxscript Up to this point)
WHAT YOU CAN'T DO, However is continue
If NewTurb.y>0 then NewTurb.y *=-1
converting it into a vector does you no good,
as ultimately $ForceWind.turbulence is defined and
controlled in maxscript as a float...
Any ideas????
Another thing, if you have the pCont.position
part of the script post wind control the
wind will still over-ride the position call of
if CurPos.y>0 then CurPos.y*=-1
--EDIT
Actually you can overide the turbulence
by moving the force pre-script
I had it post script
So mucjh for writing messages away from Max
Thanks, I hope this makes sense.....
hi ...
my current unknown...
i want to use a script test operator and when it tests true i want the particles that test true to spawn copies to the new event while staying themselves in the currrent event.
i read somewhere that creating particles inside script is big no no? (except in birth script) .. is there an easy way to achieve this??
something like a script spawn is what i want i guess.
im just getting into scripted particle flow.. its totally wicked, so much control.
this forum has been a world of help already. you guys rule.
hope someone can help
cheers
I'm basically trying to bend bobo's mass affects force script to my will, because I don't want the run-up involved with using a force. I would rather use the speed operator for the initial velocity of the particles, and have this speed affected by the scale of the particle. I don't understand why I cannot just have the script read the scale, and then base the velocity off of this like you would with the wired controller. Can someone pull the wool from over my eyes please? Its likely something obvious that I am missing. Thanks in advance.
Geoff
I have a very simple script I can add to a button to turn off all flows in the scene, the problem is that each flow gets updated before it turns off, which can be very time consuming. Is there another way I can write this so the it just disables the flow without updating it first?
[code:1]pfArr = for obj in geometry collect (if classOf obj != pf_source then continue;else obj)
for pf in pfArr do pf.baseObject.activateParticles off[/code:1]
Tuomas Jomppanen wrote a script for PFlow when he found out that Mesher loses all UV's. The script creates instance of every particle in selected PF Source.
You can find it on [url=http://www.jomppanen.com]www.jomppanen.com[/url] at the maxscript page:
[img]http://www.jomppanen.com/scripts/pflow_screenshot1.gif[/img]
Thanks for sharing,
Oleg B.
Not sure how else to title this thread, but here goes. For the particle flow-driven space battle i'm working on, thanks to Bobo at cgtalk, I have been able to work with some scripts that allow one particle to shoot at other particles based on mathematical equation that determines if the 'enemy particles' are in a certain view radius of the 'good particle'
The following code bits are what I have.
This script determines the 'view radius' for shooting bullets:
[quote]on Init pCont do
(
global asteroids_Rocks = #()
)
on Proceed pCont do
(
t1 = pCont.getTimeStart() as float
t2 = pCont.getTimeEnd() as float
for i in asteroids_Rocks do
(
theCount = pCont.NumParticles()
if theCount < 50 then
(
theShipTM = copy asteroids_ship
theShipTM.row4 = [0,0,0]
theShipLookVector = normalize ([0,2,0] * theShipTM)
theShipToRockVector = normalize (i.row4 - asteroids_ship.row4)
theAngle = acos (dot theShipLookVector theShipToRockVector)
if theAngle < 10.0 do
(
pCont.AddParticle()
pCont.particleIndex = theCount + 1
pCont.particleTime = t1/TicksPerFrame
pCont.particleAge = 0
pCont.particleTM = asteroids_ship
--pCont.particlePosition = asteroids_ship.row4
--print pCont.particleTM
pCont.particleSpeed = [0,0.05,0] * theShipTM
)
)
)
)
[/quote]
And this code checks for a bullet hit on the enemy particles:
[quote]on Init pCont do
(
global Asteroids_RocksHit = #()
global Asteroids_RocksHitNum = #()
)
on Proceed pCont do
(
count = pCont.NumParticles()
if count == Asteroids_RocksHit.count then
(
for i in 1 to count do
(
pCont.particleIndex = i
if Asteroids_RocksHit[i] == true then
(
pCont.particleTestStatus = true
pCont.particleTestTime = pCont.particleTime
)
)
)
)
[/quote]
Now, the problem is, i'm going to need more than one 'good ship' and, from the base code bobo provided and what I have worked on, only one good particle may exist. This can be fixed, as Bobo says,
[quote]you cannot simply increase the number of ships because there are some hard-coded assumptions that there is just one, but it is technically possible (the ships' positions would have to be written to an array, too, and the shooting code would have to loop through them all).
[/quote]
I'm not exactly sure how to go about doing this however, because i'm still a noob at maxscripting. Any ideas on how to approach it would be greatly appreciated.
The other question I have is, with the code i'm working with now, when an 'enemy particle' is in the sights of the 'good particle' and the 'good particle' triggers to fire, it fires one particle per frame. How can I control this more along the lines of a birth operator and control how many particles are emitted per so many frames; because 1 particle per frame looks quite silly at the moment...
Thanks for all your help guys!
is there a possibility to script the lock bond event in maxscript?
because i want to set up a pflow tutorial where the lock/bons is needed but i can´t assume eveybody is having the toolbox :(
i allready found tutorials here in the forum concerning surface-binding but not as accurate as the lock bond does :(
hope to find help
psycho
I'm trying to write a script test that tests whether a particle is facing away from an object. I'm really pulling my hair out. I can't figure it out. Anyone have any ideas?
Khye
Is it possible to read the position info of particles in a flow
so that I can assign a projector light to its position.
For example at frame 5 particle ID000 is at 0,0,0 and ID001
is at 0,0,10 so (posID000.z + posID001.z)/2 would equal an
average (considering z only ) of 0,0,5...well its easy with just two
particles...how would one calculate the average displacement
from a set point (0,0,0) for thousands of particles?
I am attemtping to have say 20 boxes follow 200 particles over
the default 30 frames.
If I run the standard
....
NewID=pCont.particleID
MYBOXES[NewID].pos=pCont.getParticlePositionbyID NewID
....
I will naturally get errors as there are only 20 boxes trying to follow 200
particle controllers.
What I am asking you scripting masters is if there is a way to assign
say BOX01 to ID10
BOX02 to 1D20
....
BOX07 to ID70 ...and so on....
etc etc, so that every 10th particle controls one of the boxes in the array...
Any ideas???
Thanks
I was wondering if it is possible to have seperate find targets
created for a multi Stroke particle paint.
Let me expalin more...
Particle Paint Helper consists of 5 strokes
for a total of 500 "seeds" over 60 frames.
Stroke #1 100 seeds frame 0-60
Stroke #2 100 seeds frame 10-70
Stroke #3 100 seeds frame 20-80
Stroke #4 100 seeds frame 3--70
Stroke #5 100 seeds frame 40-100
So, the first find target would find stroke #1
over the alloted frames
and the other 4 find targets its alloted strokes
over the above mentioned times.
As there is only one vector channel I was thinking
maybe a script that uses the matrix channel could be
used to pump up the number of find targets
does anyone think this might be posible?
Hello,
I am currently attempting to use maxscript to assign a "Lock On Object" in a Lock and Bond Operator. It's looking for a node array but when I give it one, I get a crash.
$'PF Source 01'.Event_01.lock_bond_01.lock_on_objects = #($Teapot01)
I tried using append and set property, both of which I get errors. The position object operator works ok with this method, so I'm assuming that this is the way to do it.
Is there another way?
Thanks!
Nelson
From a memory and resource point of view, is it better to try to
stuff as much as possible into one big script operator, or is it
better to split the functionality over several scripts.
For example, of late I have been combining float generation, position
randomizition, and position to vector storage into one script, although
from a flow design it would make sense to have each in its own seperate
operator (as it appears in PFView)....
Any thoughts?
Im trying to position pflow particles to legacy particles... one main reason is because id like to take advantage of some features in pflow not available in the legacy ones... :D
So basically, particle movement would be driven by a legacy particle system, then pflow would just add up additional touches(probably a lot) to it.
here's what i got so far.
In the example below, i used a [color=blue]Path Follow SpaceWarp [/color]for a [color=blue]SuperSpray[/color], the Path Follow is using an animated spline.
[img]http://www.orbaz.com/forum/files/path_follow_screen01_160.giff[/img]
So far, Ive managed to place pflow particles to each legacy particle using these scripts:
BIRTH SCRIPT:
[code:1]
on ChannelsUsed pCont do
(
pcont.useAge = true
)
on Init pCont do
(
global psys = $SuperSpray01
)
on Proceed pCont do
(
pcount = particlecount psys
for i in 1 to pcount do
(
if try((particleAge psys i) == 0)catch(false) do
(
pcont.addparticle()
)
)
)
on Release pCont do ()
[/code:1]
The birth script will count the particles in superspray, loop through each and check for a particle having an age of "0", if it finds one, pflow will then create a particle ->pcont.addparticle().
SCRIPT OPERATOR
[code:1]
on ChannelsUsed pCont do
(
pcont.usePosition = true
pcont.useInteger = true
)
on Init pCont do
(
)
on Proceed pCont do
(
pcount = particlecount psys
for i in 1 to pcount do
(
if try((particleAge psys i) >= 0)catch(false) do
(
pcont.particleID = i
pcont.particlePosition = particlePos psys i
pcont.particleInteger = pcont.particleAge
)
)
)
on Release pCont do ()
[/code:1]
The script operator in turn would also loop though each particle of the superspray checking for an age which is equal or greater than "0", thus positions' the created particle accordingly...
Currently, its working out OK, im scrubbing the timeline and everything seems to be in order...
The problem arised when I started testing some renders... it seems that pflow is not reading through each frame or something because there is no animation going on..
I've set the integration step for the rendering also to [color=blue]FRAMES[/color], same as the ones im using for the viewport, but still to no avail :(
Another weird thing happening is when i scrub from frame zero onwards, stop at say frame 40, then go back one frame to 39, a particle would appear to place itself at [0,0,0] world...
[img]http://www.orbaz.com/forum/files/path_follow_zero_787.gif[/img]
here's a max file of this scene: [url=http://www.orbaz.com/forum/files/path_follow_test01_208.zip]path_follow_test01.zip (21KB)[/url]
Jeff
***
I only ended up trying to go through this method because I cant get a similar particle movement done by a path follow spacewarp using pflow... if there's a way to simulate a path follow in pflow, Im very much all ears to hear it :) (Speed by Icon works a little differently usign paths)
Just can't seem to figure it out, but how can you store the time of birth of a particle say that is spawned after a collision? I'm sure the answer is ridiculously easy, just that It's always overwriting it when I scrub the timeline.
As Birth Paint and Placement Paint (via Particle Paint)
read the Particle ID order (with print to position selected),
I was wondering if there is a way to reverse the ID order
so, instead of the particles printing from left to right
the order could be inverted so it went right to left.
I have tried things like this, but my formula will not work
unless all the particles are birthed on the same frame
(as the count is changing as the birth # of particles occurs)
New ID=(Count-1)+1
Let's say you have 10 particles, lets sub in the numbers
assuming that count is constant (which it usually isn't)
orig new
1 10
2 9
3 8
4 7
5 6
6 5
7 4
8 3
9 2
10 1
Any ideas, my attempts have failed quite vividly!
While this is not exactly a Script Operator script, it does work on PFlow.
Here is the script
[url]www.charleycarlat.com/MaxScripts/pfSpliner.ms[/url]
Unfortunately it does not support animation, it only generates static Splines based on the Flow within a given time frame. Right now there is no interface for the script, although I will add one eventually. I haven't tried it on flows with particles that die mid flow...not sure what it would do. It does support spawning, however there is a really good chance that the incements you specify within the script for the Spline Knots will not be the same as the increment where the actual spawn occurs...thus the spawned spline wont connect completey with the Spline it spawned from. I wrote this script for R5 when Particle Flow extension just came out and have only recently started using it again. I am sure there are areas that could be better scripted..but here it is..as is.
One more word of caution. Max does not like 1000's of seperate objects in the scene, so you can easily crash max if you are not careful.
Here is an example I did with it.
[url]www.charleycarlat.com/MaxScripts/PF_Splines.jpg[/url]
sorry, my languge is not good but i will try to explain.
__________________________________________________
1.If I want to use Material Editor It's must use 'max mtledit'
then if i want to close Material Editor , how to ??
2.About show picture sysInfo.currentdir+ "\image\aaa.gif"
sysInfo.currentdir is current directory
but if I use selectBitmap anothor part
If we restart script, It will not show the picture because path is change to new path
sysInfo.currentdir ---> C:\Documents and Settings\A\My Documents\My Pictures\
How can fix it ?
3.
on makeobj pressed do (
a += 1
NameBuild = "Building0" + (a) as string
NameCamera = "Camera0" + (a) as string
max create mode
Building = Box lengthsegs:1 widthsegs:1 heightsegs:1 length:LengthBuild.value width:WidthBuild.value height:HeightBuild mapCoords:on pos:[Xbuild,Ybuild,0] isSelected:on name:NameBuild
.......
max mtledit
meditMaterials[a].diffuseMapEnable = on
meditMaterials[a].diffuseMap = Camera_Map_Per_Pixel ()
meditMaterials[a].diffuseMap.camera = Camera
meditMaterials[a].diffuseMap.texture = Bitmaptexture fileName:PathPicture.text
meditMaterials[a].diffuseMap.texture.alphaSource = 2
Building.material = meditMaterials[a] --> Can use
)
--but I write anothor
on Composit pressed do
(
aa = a-1
max mtledit
meditMaterials[10].diffuseMap = undefined
meditMaterials[10].diffuseMapEnable = on
meditMaterials[10].diffuseMap = CompositeTexturemap ()
meditMaterials[10].diffuseMap.mapList.count = aa
for b=0 to aa do
(
b += 1
(
meditMaterials[10].diffuseMap.mapEnabled[b] = on
meditMaterials[10].diffuseMap.mapList[b] = Camera_Map_Per_Pixel ()
meditMaterials[10].diffuseMap.mapList[b].camera = meditMaterials[b].diffuseMap.camera
meditMaterials[10].diffuseMap.mapList[b].texture = meditMaterials[b].diffuseMap.texture
meditMaterials[10].diffuseMap.mapList[b].texture.alphaSource = 2
)
Building.material = meditMaterials[10]) --> It's Error b'coz Building undefined but If open MaxScript Listener , print 'Building' and enter, Restart Script , error dispear and building can defined --> What's wrong, How can fix it?
)
I've taken to modifying Bobo's RidetheFlow script to add a camera to a particle. I've set the camera to always be a little bit up and behind the particle and the camera angle a bit down so it can sort of be a 3rd-person view of the particle (Ship in this case). however, the camera will only point forward when the particle goes in one direction. If it reverses, the camera will flip over and resume pointing the way it was before, while the particle continues in the opposite direction. How can you resolve this? Here's the script:
[quote]on ChannelsUsed pCont do
(
pCont.useTM = true
)
on Init pCont do
(
global ShipCam = $pflow_travel_camera_170268
if ShipCam == undefined then
ShipCam = FreeCamera name:"ShipCam"
)
on Proceed pCont do
(
index = 0
rideParticleId = 1
if pCont.hasParticleId rideParticleId &index then
(
pCont.particleIndex = index
ShipCam.transform = pCont.particleTM
rotate ShipCam (angleaxis 90 [0,1,0])
move ShipCam [60,0,20]
)
)
on Release pCont do
(
)
[/quote]
I finally found this forum, figured I can get a lot more focused help here.
I've spearheaded a Collaborative film that is a space battle entirely generated and driven by Particle Flow. Part of the innovation lies in the use of Particle Flow to allow fighter ships to fight each other autonomously through Particle flow operators. I'll have many questions and threads for help on this shortly... :p For now, I'm trying to get particle (ships) to bank as they turn. The thread I started at CGTalk about this is [url=http://cgtalk.com/showthread.php?p=2426849#post2426849]here[/url]. I don't know what else to repeat that hasn't been said in there already, so if you guys could help on this, I would appreciate it. Thanks!
Hi everyone who read this line,
I need to transform an object to fragment of this object and this particules have to go to transform themself to an other object, like we could do in Particule Studio. But in Particule flow i don't know how to transform an objet to particule/fragment of this object.
I install Particule Studio one more time and it works, but i can't render particule of this plugin in mental ray :!:.
So, i'm looking for someone who can help me to find witch script i must write or other solution to have this result in Particule flow !
My mind is out of order while I start to find this solution.
[u]Thanks[/u]
FMU
I created a fairly simple script to turn a set of selected objects into particles, as with Bobo's custom chunks tutorial. It works fine when run from a new script window, but not when run from an "on button pressed do" context.
The particles don't show up at all. It appears as though 'Event 01' and 'PF Source 01' aren't getting connected properly. If I manually delete the connecting wire and then reconnect them, they the particles show up fine.
Here's the script:
[quote]-- define then selected objects as an array
GLBL_chunkArr = selection as array
-- get the overall center of the selected objects
centerVal = [0,0,0]
for i in GLBL_chunkArr do centerVal += i.center
pfCenter = centerVal / GLBL_chunkArr.count
-- define the script as a string for Birth Script operator
ssVar = stringstream ""
format "on ChannelsUsed pCont do (\n" to:ssVar
format " pCont.useTM = true\n" to:ssVar
format " pCont.useShape = true\n" to:ssVar
format " pCont.useAge = true\n" to:ssVar
format " )\n" to:ssVar
format "\n" to:ssVar
format "on Init pCont do ()\n" to:ssVar
format "\n" to:ssVar
format "on Proceed pCont do (\n" to:ssVar
format " t = pCont.getTimeStart() as float\n" to:ssVar
format " if t < 0 then (\n" to:ssVar
format " n = GLBL_chunkArr.count\n" to:ssVar
format " for i = 1 to n do (\n" to:ssVar
format " pCont.addParticle()\n" to:ssVar
format " pCont.particleIndex = i\n" to:ssVar
format " pCont.particleAge = 0\n" to:ssVar
format " pCont.particleTM = GLBL_chunkArr[i].transform\n" to:ssVar
format " pCont.particleShape = GLBL_chunkArr[i].mesh\n" to:ssVar
format " )\n" to:ssVar
format " )\n" to:ssVar
format " )\n" to:ssVar
format "\n" to:ssVar
format "on Release pCont do ()" to:ssVar
ssVar = ssVar as string
-- create new particle flow
newPF = PF_Source X_Coord:0 Y_Coord:0 isSelected:on Logo_Size:5 Emitter_Length:10 Emitter_Width:10 Emitter_Height:10 pos:pfCenter
newPF.quantity_viewport = 100
newPF.particle_amount_limit = 10000000
event01 = event()
-- begin editing pFlow
particleFlow.beginEdit()
-- add the Render operator to PF Source 01
newPF.appendAction (renderParticles())
-- create the Birth Script operator and add to Event 01
so = Birth_Script()
event01.appendAction so
-- add the previously defined script to the Birth Script operator
so.Proceed_Script = ssVar
-- create the Display and Speed operators, and add to Event 01
event01.appendAction (displayParticles type:6)
event01.appendAction (speed direction:1)
-- get PF Source position in particle view window
newPF_X = newPF_Y = 0
newPF.getPViewLocation &newPF_X &newPF_Y
-- hook Event 01 to PF Source 01
newPF.appendInitialActionList event01
-- reposition Event 01
event01.setPViewLocation newPF_X (newPF_Y + 80)
-- end pFlow edit
particleFlow.endEdit()
-- open the Particle View window
particleFlow.openParticleView()[/quote]
Greetings,
I'm importing particles from Houdini into Max so they can be rendered with Vray, I have the positions in and working, but the velocities are completely out of whack.
In the Houdini files the velocities are stored as m/s what are the units of the pCont.particleSpeed attribute so I can apply a scaling factor ?
Thanks.
Is it possible to access the face or element number in the Shape Instance Op when using Object Elements? Does it randomly assign elements to particles or will it do so in a certain order?
Lets say I have an object with 100 elements. I don't want to have 100 extra objects in the scene (in my case I have 43,27 elements so...). I have written a script that puts a particle at each face center (all my elements are single Poly faces). I assumed/hoped that the Shape Instance Op would start at the first element (or the one containing face 1) and assign that shape to the first particle, and continue on in numerical order, repeating only if there were more particles then elemtents. However, this does not seem to be the case, so now I am wondering if there is a way to pick elements out of the Shape Instance Op. Does this make sense?
Although not related specifically to PFlow, another way to do this would be to create a Mesh definition from a sub-Object element and by pass the Shape Instance Operator all together. Does anyone by chance know how to do that.
The last resort will be to attemt to break each part into its own object, however when all is finished with the number of fraged objects, I could concievably have a couple hundred thousand objects...I don't think max will like that if it even lets me do it.
Perhaps this would be a nice Wish List item (either a check box to have Shape Instance Op locate particles according to there position within the source object, or have it as a Birth Op. Ofcourse if you do indeed add fracturing into one of your future Tool Box's, this will not matter anyway :D
In an earlier post I was trying to get particles to move a bunch of boxes so that I could use the Skin modifier the have the boxes move a mesh plane. But then it occured to me that I could just move the verts of the mesh directly, duh. So I experimented with that and it's working pretty good. I'm going to do more experiments, but I thought I'd post my first pass here.
[url]http://jhaywood.com/ftp/pFlowDeformMesh_001.mov[/url]
[url]http://jhaywood.com/ftp/pFlowDeformMesh_001.zip[/url]
I can't figure out why this scene is not working as expected. I'm trying to get a bunch of boxes to move along with a bunch of particles after a collision test. There should be a one to one relationship with particle to box, but it doesn't seem to be working.
Seems like it should be pretty straight forward. Here's the script I'm using:
on ChannelsUsed pCont do (pCont.useTM = true)
on Init pCont do (global skinBoxArr)
on Proceed pCont do
(
count = pCont.NumParticles()
for i in 1 to count do
(
skinBoxArr[i].transform = pCont.getParticleTMByID i
)
)
on Release pCont do ()
[url]http://jhaywood.com/ftp/skinPlane_002.zip[/url]
Hello,
I am having issues using maxscript to update the material in my "material static" operator. Here is a simple test case that I put together to simulate the error I am getting.
In the max file you will notice that there are two colors on random teapots. If you execute the script, which basically generates two materials into one multi/sub material and applies it to the "material static" operator as well as the first slot of the material editor, you will notice that there is no change in the teapots.
To see that the material has actually changed but not updated, drag and drop the slot 1 mat in the material editor into the "material static" mat slot. There should be an immediate change in the viewport.
Is there something I can do in the script to force a material update?
Here's the scene: [url=http://www.orbaz.com/forumData/scenes/20050614/MatUpdateTest.zip]MatUpdateTest.zip[/url]
And here's the script:
[code:1](
-- For Color randomization
local colorAry = #(Red, green, blue, white, black, orange, yellow, brown, gray)
local cRand1 = random 1 colorAry.count
local cRand2 = random 1 colorAry.count
-- Create Color 1
local mMaterial1 = Standardmaterial ()
mMaterial1.shaderType = 1
mMaterial1.adTextureLock = on
mMaterial1.diffuseColor = colorAry[cRand1]
mMaterial1.selfIllumAmount = 100
-- Create Color 2
local mMaterial2 = Standardmaterial ()
mMaterial2.shaderType = 1
mMaterial2.adTextureLock = on
mMaterial2.diffuseColor = colorAry[cRand2]
mMaterial2.selfIllumAmount = 100
-- Create multimaterial
local tmpMat = MultiMaterial()
tmpMat.name = "Consolidated_Mat_POLY_RGBMULT"
tmpMat.materialList = #(mMaterial1, mMaterial2)
tmpMat.materialIDList = #(1,2)
meditmaterials[1] = tmpmat
-- Apply material
local event01 = $'Pf Source 01'.event_01
numActions = event01.NumActions()
for ii in 1 to numActions do
(
local cAction = event01.GetAction ii
if ClassOf cAction == Material_Static then
(
cAction.Assigned_Material = undefined
cAction.Number_of_Sub_Materials = 2
cAction.Assigned_Material = tmpMat
)
)
)[/code:1]
Thanks!
Nelson
There has got to be a better way to do this. I have mesh objects (projectiles) inheriting positions from a Pflow system that includes a find target operator. Then I have a seperate event that spawns when the initial flow collides with a deflector, then references the projectiles as its target in a find target operator. Is there a better way to do this? Surely there is a way to script the Pflow such that when the projectile, which is driven by a find target test, collides with a deflector along the way to its target, can spawn a completely seperate Pflow Source which targets the aforementioned projectiles. Any ideas? Thanks!
Geoff
what is the correct way to write out
pcont.rand0x in a script line
I know it is the funtional equivalent of (for example)
12*(pcont.rand01()) as integer
but i have not gotten say pcont.rand0[12] to work
and pcont.particlespin is described as <angleaxis>
from maxscript help:
[i]Constructors
angleaxis <degrees_float> <axis_point3>
<quat> as angleaxis
<eulerangle> as angleaxis
<matrix3> as angleaxis
extracts the rotation component as an angleaxis
Operators
<angleaxis> == <angleaxis>
<angleaxis> != <angleaxis>
<angleaxis> as <class>
AngleAxis can convert to Matrix3's, Quat's, Eulerangle's
Properties
<angleaxis>.angle : Float
<angleaxis>.axis : Point3
<angleaxis>.numrevs : Integer
Methods
copy <angleaxis>
Creates a new copy of the angleaxis value. For example:
newAngleAxis = copy oldAngleAxis
The new value contains a copy of the input angleaxis value, and is independent of the input angleaxis value.
random <angleaxis> <angleaxis>
Random rotation in degrees, but uses quat Slerp, so loses multiple revolution angles.
[/i]
any hint as how to write this out in a script????
thanks
Hello,
I've created a script that lets me group different pflows into selection set-like groups. This is so I can turn on and off groups of pflows for different shots and such..simple script, but I've run into a problem where calling [i]Enable_Particles[/i] doesn't actually do anything for a bunch of pflows. While in PView, calling [i]<PF_Source>.Enable_Particles[/i] does indeed toggle the lightbulb icon, but the particles fail to actually turn off or on in the viewport...
Is there some kind of refresh thing I am simply missing? I can't figure out why it works for some pflows and not others. Anyone run into this problem at all?
Thank you,
Bill Dahlinger
It's my first post here, and I'm new to particle flow. I know a little bit maxscript. I wonder if it's possible to let the particles walking on a moving surface, just like an ant wandering on your arm, and it's always on your arm while you are waving.
I've no idea at all. Great if any guru can help. Thx.
Hello,
I am currently scripting a series of functions in the Proceed section of a script operator. For optimization reasons, I need to only execute those functions on the current frame (aka the frame being rendered) and not on any frame leading up to that.
Is there any way in the script operator to get the value of the current time frame? The global "currentTime" would work, but it doesnt get updated during render time.
Thanks,
Nelson
Hi everyone,
This might be a dumb question, but does anyone know the best way to parse through the action lists through maxscript without knowing the names of each one?
IE. A way to get to $'PF Source 01'.event_01 without knowing "event_01"
Thanks,
Nelson
I remember INT command from my Basic days, and decided to
pop it into a line as such
pCont.particleFloat =int(8.0/pcont.particleage)
yet, i can find no reference to this in Maxscript reference, or anywhere
on the internet...
In Basic, it means to only take numbers like -3,4,6 (no floating point)
Since I am learning pflow maxscript before "max" maxscript, I really
am just "punching stuff in"
please advise!
With two different flows set up, the first with a find target
by vector channel, and the second one with a store position
data to vector channel script operator, is it possible to have pfsource #01
to read the value from the external flow?
I have tried setting up a group operator, that references the second event,
but this appears to not work, and i have tried to merge the second
event into the first..no success...
My first flow is a particlepaint/birth paint with 600 particles over 2 seconds
with the letter "A", and my second (invisible flow) is 600 particles over 2
second particlepaint/birth paint to the letter "B"
What I was trying to achieve was have the letter "A" build up
(this is a breeze with the Particle Paint helper!), then after an
age test of 60, to to a 30 frame find target by vector, which would allow the letter "A" to morph to the letter "B"....
Is it possible?
Here's the scene: [url=http://www.orbaz.com/forumData/scenes/20050415/ALT04.zip]ALT04.zip[/url]
Heya Folks,
I'm new to pflow scripting and I'm wondering if it's possible to script collision spawning - what I'm doing is pretty much a shatter effect but what I'd like to do is have pre made cracks for the object that I can use as the collision spawn particles so pretty much do this:
Use something like bobos script tutorial to load in 2 sets of objects:
Large fragments and smaller fragments that are broken pieces of the larger pieces with the same pivot point as the large fragments it comes from
the main particles and drop them using regular gravities etc. When the particle collides with a deflector, have a script that accesses the collided particles transform, make an array of the corrosponding smaller shater bits, assign the transform of the larger fragment and then either bounce the particles as per the collision spawn or if that isn't possible just a speed by surface or similar so I can bounce my fragments around.
I'm sure I can just do a loop using stuff like setParticleTM to assign the transform properties but I'm curious to see if I can script the collision so that the amount of spawned particles matches the array count of the corrosponding fragments?
I'm going to try some things now and see how far I get - I assume that I can just use a script operator in the event after the collision spawn to assign the shape and transform of the smaller fragments but I'm curious how to do things like limit the particle spawns to the array count of my fragments and script the test to only occur after a collision - I'm sure I could probably control it using naming.
Sorry for what are probably basic questions but there's nothing in the documentation about pflow.
I'm on max 5.1.
Cheers,
John
Any script wizards can lend me a hand? Trying to make a stream of atoms connected with spline sticks between them.
I have done this with normal spheres with the linked Xform modifier before, how does one do the thing using particle flow?
What I want to do is create a new flow with a Position Object operator, if an object is selected, and use the selected object as the emitter object. If I step through this code one line at a time it works fine, but if I evaluate it all at once the selected object doesn't get added as the emitter, anyone know why?
[code:1]
newPF = PF_Source X_Coord:0 Y_Coord:0 isSelected:on Logo_Size:5 Emitter_Length:10 Emitter_Width:10 Emitter_Height:10 pos:[0,0,0]
newPF.quantity_viewport = 100
newPF.particle_amount_limit = 10000000
obj = selection[1]
event01 = event()
particleFlow.beginEdit()
newPF.appendAction (renderParticles())
event01.appendAction (birth emit_stop:0)
event01.appendAction (displayParticles type:1)
if obj != undefined and superClassOf obj == geometryClass then (
po = (position_object())
event01.appendAction po
po.Emitter_Objects = #(obj)
)
else event01.appendAction (position_icon())
particleFlow.endEdit()
newPF.appendInitialActionList event01
event01.setPViewLocation 20 100
particleFlow.openParticleView()
[/code:1]
This is probably already known by advanced users, but I noticed
that with this modified Bobo birth script that you can reference
more than one group of objects in a birth script!
I find this cool......
www.agilemedia.biz/mark/multibirth.zip
on ChannelsUsed pCont do
(
pCont.useAge = true
pCont.useTM = true
pCont.useShape = true
)
on Init pCont do
(
global ARRAY_AA = $BOX* as array --THIS ASSIGNS THE BOXES
global ARRAY_BB = $SPHERE* as array --THIS ASSIGNS THE SPHERES
global ARRAY_CC = $TORUS* as array --THIS ASSIGNS THE TORUSES
global ARRAY_AA = ARRAY_AA+ ARRAY_BB+ ARRAY_CC --THIS ADDS IT ALTOGETHER
)
on Proceed pCont do
(
t = pCont.getTimeStart() as float
if t < 0 do
(
NumChunks = ARRAY_AA.count
for i = 1 to NumChunks do
(
pCont.AddParticle()
pCont.particleIndex = pCont.NumParticles()
pCont.particleAge = 0
pCont.particleTM = ARRAY_AA[i].transform
pCont.particleShape = ARRAY_AA[i].mesh
)
)
)
on Release pCont do
(
)
I'm trying to understand how best use this. From what I can tell, it returns a vector pointing in the direction the particle is traveling, but only along the X and Y axes. Why does the Z component always return 0, even if the particle is traveling up?
Is there any relation between the IDs displayed by the Display Operator when the 'Show Particle IDs' option is on and the .particleID property?
I am creating particles in a birth script and also setting the Particle ID. Later I am using a scripted test checking that ID. When I turn on 'Show Particle IDs' I was hoping to see that property. But as soon as I change the Viewport Multiplier, the ID numbers displayed by the Display operator also change and seem to reflect the index of the particles.
Is there a way to display the real .particleID?
Thanks very much
-- MartinB
Is there a way to find the position of a particle on the frame before the current one? I want to compare where it was to where it is and then find the ray that connects the two points.
I would like to know how to script particle alignment to surface normals
So far, I have used the trick of combining a Speed By Surface with a Rotation Operator that is set to Speed Space and then setting speed back to zero with a Speed Operator. Unfortunately, this turns out to be rather slow in my case.
So I am trying to script the particle orientation, since I script the particle position anyway (also, I need to compute the orientation only once at frame 0). But calculating the .particleOrientation attribute from surface normals turns out to be tricky.
This might be a basic question, but I could not find info in the online help: .particleOrientation carries Euler angle values, right?
Now I wonder how I would calculate those values from a normal that I get from 'getNormal object.mesh 123'?
Thanks in advance for any help
-- MartinB
How would one properly write a Birth Script so that the script correctly takes the Viewport Quantity Multiplier into account? So when I set the particle amount to 50%, the birth script would only produce every second particle etc...
Thanks!
-- MartinB
I'm trying to use the face normal of an object, as found by using the instersectRay command, to control the orientation of a particle, but I can't quite figure out how they're related.
I did some reading in the reference doc, and searched around here, but still don't get it. CharleyC said something about the transform[3] matrix being the same as direction, so I tried this: pCont.particleTM[3] = newRay.dir, but it doesn't seem to have any effect.
Any help understand the relationship between direction vectors, transform matrixes, and orientation would be much appreciated.
I've been using the custom chunks birth script by bobo for some time now.
[url]http://www.scriptspot.com/bobo/mxs5/pflow/pflow__Chunks_Basics.htm[/url]
There's a few issues:
1:
When closing max and starting it again, the birth script window pops up (3 times) - even though it's a completely fresh max start.
2:
When editing/displaying the script window (in a scene where it's supposed to be) the colors in the script are not set up properly. Eg. everything is black, until I start editing a line, then the "on, do, as" etc. turn blue on the line I'm editing on.
3:
Max seems somewhat unstable when using the birth script. Meaning it suddenly pop up the birth script window (in a scene where the script is, yes) without my prior clicking the edit button.. and when i close the window, max will crash displaying the "Hi.. I'm crashing.. wanna save first?" dialog. Not sure if this is a pflow scripting issue, maxscripting issue or just my computer acting odd.
(The only thing I've changed in the bobo birth script is the name of the objects being fed into the array.)
Any thoughts on any/all of this will be greatly appreciated.
Hi all,
I've got a question on Particles and their color using maxScript.
How could I access using Maxscript to the material of a particle ?
I have a PFSource with a Material Dynamic (Sub Mat Roto set to Random with a rate set to 0.0) and I would like to know how to find the material associated to a particule
I tried to access to this component via the GetFaceMatID method but I always have 1 as result.
particle = $.particleShape
mat = GetFaceMatID particle 1
I also tried to convert my particle to an Editable_mesh After that, I obtain a Trimesh I guess I have to convert it into Mesh with :
msh = Editable_mesh()
msh.mesh = particle
But if I use
msh.material I ve got an undefined value....
If somebody could have an idea or a solution, that could be very helpful.
Thanks.
If you add pcont.particleposition = pcont.particleposition + [0,-5,0]
in a script operator before scale random 3d, but after a spawn
(say 50) instances..it modulates the explosion towards the
negative y axis (towards the camera)
if combined with a delete by age 30 in the same event, as well
as age test = 30 sent to a spawn (delete parent) sending back
1/50 of the particles (split amount) for re-generation, you'd get a recursive
movement of spawns constantly branching off and exploding
towards the camera (that's my theory anyways!)
gotta try this at work tommorow!! :P
Oleg, I have a scene that uses a final step update script to create and delete at particle positions. No matter the object type (light, geometry, shape) on save, I get this error
[code:1]Assertion Error Information
In File: 'basenode.cpp' Line 7686
[/code:1]
It works perfectly in rendering and viewport, but saving is its demise. I know the scripting reference warns of delete/create things in pflow so 'I warned you' is a totally viable response. It just strikes me that it can't save it.
Simply unchecking the FInal Step Update allows a successful save. The work around that I can think of is to do a filePreSave and filePostOpen to uncheck on save and check on open.
Any thoughts?
[code:1]
if myArray != undefined do delete lightArray
myArray = #()
pf_node_current = particleFlow.scriptRunner() -- current particle system
if (pf_node_current != undefined) then
(
count = pf_node_current.NumParticles()
for i in 1 to count do
(
pf_node_current.particleIndex = i
j = omnilight pos:[0,0,0]
lightArray += j
j.transform = pf_node_current.particleTM
)
)
[/code:1]
*note: myArray is predefined outside of this script.
Hi guys,
I am trying to make an omni flash with the emission of a particle. I want the light to be bright at the moment of emission, then fade over a couple of frames before flashing bright again at the next emission.
The idea is to use the light for the muzzle flash of a gun.
Any help would be appreciated.
Thanks,
Jason
I'm trying to have a prerender script generate lights at the locations of particles. Is there a way to access the position of each particle outside of pflow?
The best I can think of is to have the script operator in pflow create an array of all the positions which I could than access outside of pflow. Just wondering if there was a better way to do this.
khye
I have been scouring the Maxhelp/Maxscript/ for any himt on the
makeup on the illustrious matrix
I found this passage
Properties
<matrix3>.row1 : Point3
<matrix3>.row2 : Point3
<matrix3>.row3 : Point3
<matrix3>.row4 : Point3
<matrix3>.translation : Point3
read/write access to rows. Row4 is the translation.
What I am trying to figure out is what each row means to mere
mortals...I created a transformation script for a sphere
in the trackview which
basically reads <matrix 3> [1,0,0] [0,1,0] [0,0,1] [0,0,0]
then only thing I've been able to figure out(by typing in numbers
and hitting evaluate) is that row4 controls
the x,y,z position
now this transformation script seems to be the functional equivalant
of what i have seem in pflow scripts...but what do the first 3 rows do?
Hello,
What is the difference between birthing particles at 0 and any other frame? I have a script operator that crashes, giving me an "unknown system exception," when I change the birth frame and move the slider to that frame, but works fine when I am at 0.
Thanks,
Nelson
On the bottom of the script operator there is an extensive list
of maxscript operators...the ones with <void>, i assume these
are non-implemented?
-- <void>setParticleMatrix <index>particleIndex <matrix3>matrixValue
-- <void>setParticleMatrixByID <index>particleID <matrix3>matrixValue
how do i set this correctly?
I've tried the ff:
[code:1]objArray[i].rotation = pcont.particleOrientation[/code:1]
[code:1]objArray[i].rotation.x = pcont.particleOrientation.x
objArray[i].rotation.y = pcont.particleOrientation.y
objArray[i].rotation.z = pcont.particleOrientation.z[/code:1]
[code:1]objArray[i].rotation = (pcont.particleOrientation as eulerangles) ...as quat, as angleaxis...
[/code:1]
none seem to work correctly...
i dont want to use the [color=blue].particleTM[/color] property coz i only need to modify its rotation...
any help wud be greatly appreciated...
if velocity is defined by
[i]
velocity = length pCont.particleSpeed
[/i]
then how is acceleration defined
i have been playing around with scripting this in an operator
but i'd like to know what its mathematical syntax is in
particle flow
thanks
I'm using a script operator to simulate a speedByIcon. I have a point animated along a path and can reference its position just fine and put the particles at that position. Where I'm running into problems is using the [code:1]at time[/code:1] context. When I add this line [code:1]pCont.particlePosition = $point05.pos at time pCont.particleAge [/code:1]it results in an error. Is there any way to import this data to make this work? or is there a way to take the .speed straight off a speedByIcon helper and put it into the particle?
Khye
I was wondering if it is posible to have a float channel
operator (such as pcont.particleage) controla vector
channel operators (such as pcont.particlespeed).
I know that particle age, particle ID, Index, and integer
can all be defined as floats [n] ....and items as speed, orientation,
etc as [n1], [n2], [n3]...
What I tried, as I don't know enuogh, is this
[i]on Proceed pCont do
(
count = pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
v = pCont.particleVector
v[1] = pCont.particleAge*100
v[2] = pCont.particleAge*200
v[3] = pCont.particleAge*400
pcont.particlespeed = v
)
)
[/i]
now this script doesn't work and i was wondering
what grevious error i am making
:oops:
There is an option in find target test
to have it chase to a point known
as script vector
i loaded up the following into a script
operator and put this before the find target
and set the find target test to script vector
(i think i deleted a bracket here, but it worked
in max)
Now basically it got the particle system to move
towards particle #1 (it chased itself) after it went
to the event with the script operator and find target
Is this the purpose of the vector?
Is it used so other particles can find particles?
I understand it well for icons and mesh, but
as for script vector usage...i still am a total noob!!!
I am a bit confused as to its correct syntax
on Proceed pCont do
(
count = pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
v = pCont.particleVector
pCont.particleVector = v
)
)
on Release pCont do ( )
Thanks for your patience... :? :? :?
Mark's post got me tinkering around and I came up with a question. In this file
www.charleycarlat.com/Tests/PF_Speed-In-Direction.zip
I have a script that assigns the Orientation to the Speed. There is a Spin Operator right above directing the particles. It seems to work, however the particles periodically make angular turns rather than the arcs I would have expected.
Is this because of the division of the ParticleOrientation in the script, the incompatability of Speed (I assume similar to Vector) and Orientation -like maybe the angles going from 358,359,0,1,...-, or does it have something to do with the Spin Operator?
This is an example of using scripted operators to control both a push space warp and keep apart operator via particle age. It is a very simple file, but shows you the versatility of controlling forces from scripted attributes
here is the file - [url=http://www.orbaz.com/forumData/scenes/20050211/XP12_PUSH_KEEP_APART.zip]XP12_PUSH_KEEP_APART.zip[/url] (27KB).
I remember reading in the "scripting particle spiders" tutorial
that a float channel, as in the botttom example can only be used once
Does this mean the float can only be used once per flow, or does it
mean a float can be defined for different flows.
I ran into problems using the below script in my first flow for
background fireworks AND for fragmentation scripts....
So i deleted this script from the second flow,
it works sweet as a instance in the same flow, where gravity calls
it as a script wiring for a simple force by age.
what alternatives to pCont.useFloat=true exist?
thanks
on ChannelsUsed pCont do
(
pCont.useScale = true
[u]pCont.useFloat = true[/u]
pCont.useAge = true
)
on Init pCont do
(
)
on Proceed pCont do
(
count = pCont.NumParticles()
for i in 1 to count do
(
pCont.particleIndex = i
[u] pCont.particleFloat = .01*pcont.particleage[/u]
)
)
on Release pCont do
(
)
Hello,
Can you explain the difference between ID and Index?
Should I be doing this:
pCont.SetParticleFloatByID 1 42.0
or this:
pCont.particleIndex = 1
pCont.particleFloat = 42.0
Thanks,
Nelson
In the following Birth script, I noticed that you can rem out the
references to particle age in the script, as long as the geometry is sent
out to a spawn AND it is set to restart particle age.
As a scripting dummy, i'd just like to know
on ChannelsUsed pCont do
(
-- pCont.useAge = true [i]<<<i disabled this[/i]
pCont.useTM = true
pCont.useShape = true
)
on Init pCont do
(
global ARRAY_AA = $KATHY* as array
)
on Proceed pCont do
(
t = pCont.getTimeStart() as float
if t < 0 do
(
NumChunks = ARRAY_AA.count
for i = 1 to NumChunks do
(
pCont.AddParticle()
pCont.particleIndex = pCont.NumParticles()
-- pCont.particleAge = 0 [i]<<<and i disabled this[/i]
pCont.particleTM = ARRAY_AA[i].transform
pCont.particleShape = ARRAY_AA[i].mesh
)
)
)
on Release pCont do
(
)
I seem to have come across a problem with PFlow executing a script operator on only the first frame if I have a test at the end of the event. It works fine if I remove the test at the end of the event.
Event01 contains a birth, script operator 01, and a send out. The script operator "on proceed" section looks like this:
on Proceed pCont do
(
count = pCont.NumParticles()
local foo = random 0.0 100.0
for i in 1 to count do
(
pCont.particleIndex = i
pCont.particleFloat = foo
)
)
the send out is connected to a second event that contains another script operator that just prints out the particleFloat.
As I scrub the timeline, I just get one value on every frame, but if I scrub backwards, I get multiple ones. If I move Operator 02 over the send out, I get the correct output. Is this correct behavior or am I doing something wrong?
[url=http://www.orbaz.com/forumData/scenes/20050203/TestOperatorChannel.zip]Here[/url] is the scene file (3dsmax6).
Thanks,
Nelson
Hello Oleg,
I am currently creating a particle flow with script operator where I have to initialize variables when first run. The code looks a little like this:
------
local isInit
--ChannelUsed part--
on Init pCont do
(
isInit = false
)
on Proceed pCont do
(
count = pCont.numParticles()
for ii in 1 to count do
(
pCont.particleIndex = ii
if (not isInit) then (print "first")
)
isInit = true
)
-- Release part--
------
This works fine until I place the script operator into a second event. IE. I have an event with a "birth" operator and a "send out" operator which is connected to a second event containing this script operator. Any idea why that is?
Thanks for the help.
Nelson
Hi,
I have written a script that utilizes particle positions. I'm using particle index id's to track the particles, but I also want to do things with new particles that are created from spawn actions. As a new particle is born from an action, it is assigned an ID. Is there a way to track what parent particle a child particle was born from? I guess I'm looking for something like ( pf.getParticleParentID [i]n[/i] ) where [i]n[/i] is a child particle id
Thanks for any help!
Bill Dahlinger[/i]

Copyright© 2004-2005 Orbaz Technologies, Inc. All rights reserved.
|