[Closed] Spin by Age script operator for pflow?
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 ()
Yes as Piflik says you’re missing the useAge = true, then it will work.
D
That was an oversite from the script I copy/pasted.
My scripts that don’t work have the useAge=true.
You see if you set up multiple birthed boxes, use the script to spin them
yes the spin rate increased with time; but the seperate boxes still have the
same spin rate on each frame.
This was the script I should have included
on ChannelsUsed pCont do
(
pCont.useOrientation=true
pCont.useSpin = true
pCont.useAge = 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 = (180.0/4800)*((CurAge+1)/75.0)
sp.axis = [1, 0, 0]
pCont.particleSpin = sp
– print Sp
)
)
on Release pCont do ()
I think you have to swap these two lines to get the CurAge Variable get the correct Age value:
CurAge=pCont.particleAge
pCont.particleIndex = i
But I’m not entirely sure, since I don’t script too much.
Mark, it actually appears to be working here.
I created 10 particles over 100 frames (and just swapped the particleIndex line to be the first thing in the loop to be perfect) and the boxes accelerate their spin rate as they are getting older. Not sure what the problem is, can you explain or post a quicktime?
When I swap the lines as indicated it works.
Thanks for your help
Question: why is the order of the lines so important
they are both inside the for i in 1 to count loop?
All functions like pCont.ParticleAge or pCont.ParticleSpin need to know, on which particle they are applied. That does the particleIndex = i and since the lines are run through sequencially, that line has to be before anything else. (methinks :D)
I wouldn’t consider myself “Master” im just a humble Disciple. Bobo is the Master. :bowdown: :bowdown: :bowdown: