PDA

View Full Version : 1 particle per polygon?


newbie1985
01-11-2009, 02:15 PM
Hi guys,

I'm currently playing around with the script operator and birth script, but i'm not much of a scripter. I've gone through some of the threads. Seen the 1 particle per vertex script, just wondering if any one can help me out with 1 particle per polygon, preferable in the middle of each faces. I believe this would be great to be used with the shapemark operator.
Also can the particles placement only be done in the birth script? I've tried to edit the one for the birth script and use in the script operator but there's always error. And one last question in the Allan McKay's obj AB tutorial, there's 2 objects involved in the transition, and the Find Target Operator uses the script vector to directs the particle. How would i go about doing it if i wanted to do a transition between 3 or more objects? I would need the Find Target to use a different script vector at different a time.

Thanks.

PsychoSilence
01-11-2009, 09:10 PM
-- This is a script that can be used to generate particles
--
-- Created: 6-05-2002
-- Last Updated:
--
-- Author : Oleg Bayborodin
-- Version: 3ds max 5.1
--********************************************************************
-- MODIFY THIS AT YOUR OWN RISK

on ChannelsUsed pCont do
(
pCont.useTime = true
pCont.useAge = true
pCont.usePosition = true
pCont.useSpeed = true
pcont.useShape = true
)

on Init pCont do
(

)

on Proceed pCont do
(
t1 = pCont.getTimeStart() as float
t2 = pCont.getTimeEnd() as float

if (t1 < 0) then (t1 = 0)

if (t2 < 1*160) do -- 100 frames
(
for i = 1 to ((polyOp.getNumFaces $sphere) ) do
(
curTime = 8*i as float
pCont.AddParticle()
pCont.particleIndex = pCont.NumParticles() -- last particle that was added
pCont.particleTime = curTime/160
pCont.particleAge = 0
pCont.particlePosition = (polyOp.getSafeFaceCenter $sphere i)
pCont.particleSpeed = [0, 0, 0]
)
)
)

on Release pCont do
(

)


mind that u have to replace $sphere with what ever ur object´s name is. $YourObject etc.
check attached screenshot :)

kind regards,
Anselm

JohnnyRandom
01-11-2009, 09:14 PM
Nice one Anselm ;)

PsychoSilence
01-11-2009, 09:27 PM
thanks, bro! :)

its all Oleg´s script though. i just posted what sits in my script directory :D

newbie1985
01-12-2009, 03:52 PM
Thanks alot Anselm.

Comparing ur script and the one particle per vertex script. Trying to understand it. Had already tried using getFaces to replace the getVerts from the 1particle per vertex script, but it doesn't work.
hahaha..
Just wondering if there's a way to spawn the particle one by one and then with the find target operator go to the faces. I've tried to delete all but 1 particle and then using it to spawn more but the particles always go that 1 face. Is there a way to tell the particle to use the script vector from another PF source?

Thanks.

JohnnyRandom
01-13-2009, 01:40 AM
If you are using Allan's technique:

1. I if you want more than 1 target object. Add additional targets to the initial position object operator. (you asked this earlier)

2. If you want them to appear and find the targets at different times add an event with an age test in between the send out and the next event. If you don't want to see the particles prior to the them leaving the sphere (as used in his example) then just change the display ops to none or delete the display ops all together.

The premise is you are getting the particle location, storing that information, then directing your particles to go to that location when you need them too. So you need that location information before you can do anything.

newbie1985
01-14-2009, 03:47 PM
I see, didn't thought of it that way. I Haven't got the time to try it out now, will post again once i get something similar to what i imagined. I really learnt alot from the forum. Thanks alot.

lehmi
01-08-2010, 06:49 PM
-- This is a script that can be used to generate particles
--
-- Created: 6-05-2002
-- Last Updated:
--
-- Author : Oleg Bayborodin
-- Version: 3ds max 5.1
--********************************************************************
-- MODIFY THIS AT YOUR OWN RISK

on ChannelsUsed pCont do
(
pCont.useTime = true
pCont.useAge = true
pCont.usePosition = true
pCont.useSpeed = true
pcont.useShape = true
)

on Init pCont do
(

)

on Proceed pCont do
(
t1 = pCont.getTimeStart() as float
t2 = pCont.getTimeEnd() as float

if (t1 < 0) then (t1 = 0)

if (t2 < 1*160) do -- 100 frames
(
for i = 1 to ((polyOp.getNumFaces $sphere) ) do
(
curTime = 8*i as float
pCont.AddParticle()
pCont.particleIndex = pCont.NumParticles() -- last particle that was added
pCont.particleTime = curTime/160
pCont.particleAge = 0
pCont.particlePosition = (polyOp.getSafeFaceCenter $sphere i)
pCont.particleSpeed = [0, 0, 0]
)
)
)

on Release pCont do
(

)


mind that u have to replace $sphere with what ever ur object´s name is. $YourObject etc.
check attached screenshot :)

kind regards,
Anselm

Thank you very much for the script. But whatever I am doing I can't get it to work.

I've created an object, called it "sphere" tried converting it to a edit mesh, edit poly, selected the... damn... no... I didn't try selecting the polys...

just tried it out and it worked!


thanks!

:D

duke
07-28-2010, 01:51 AM
I did something similar, but am having difficulty setting the particle orientation to the face normal in the birth script. Does anyone know how to do this? I know I can do it with standard pflow operators but i'd much rather have it in the birth script :)

CGTalk Moderation
07-28-2010, 01:51 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.