PDA

View Full Version : Particle Flow Scripting birth and speed Properties based an objects rotation.


HeadSmell
02-16-2009, 06:52 AM
Hi everyone,


I am trying to create a car rig with a pflow system linked behind the wheels. I wanted to use the Madcar Plugin and have the pflow linked behind the wheels, as the car speeds up the rotation on the wheels drives the birth and speed amount in the pflow.


I am fairly new to max script and I may be in over my head here, but I was researching and thinking of basing the scripting on finding the rate of the rotation of the wheel, then a “if then statement”



(to find the wheel rate)

t1 = at time currenttime (quattoeuler $.controller.rotation).z

t2 = at time (currenttime - 1) (quattoeuler $.controller.rotation).z

rate = t1 – t2

Problem is I don't have that much experience with pflow scripting and am not sure where I need to point the pflow script to find the rate and then LINK it to change the values of the birth/speed operator.


And help would be greatly appreciated...I be roaming around the the reference material till then

JohnnyRandom
02-17-2009, 06:36 PM
I am probably not totally on the same page but anyway...in fact I pretty far off In fact I was thinking about emission as per degrees

Not sure that is going to work as the rotations are seen as 0 to 90 and 90 to 0 then 0 to -90 and -90 to 0 for a complete rotation. I am not 100% sure about how to go about it counting a full rotation.

I can get it to emit based on rotation and emit rate based on angle (but thats all at the moment)

on Init pCont do
(
global theObject = $Cylinder01
)
on Proceed pCont do
(
r1 = theObject.controller.rotation as angleaxis
a1 = r1.angle
rate = a1

if a1 >= 91 do
(
for i = 1 to rate do
(
pCont.AddParticle()
)
)
)
As for plugging it into the script operator replace the current selection with a variable that contains the objects proper name and drop the variables and expressions in the Proceed handler.

argh, I gunna edit this post a thousand times....:D

How bout an example...Max2009 SP1

HeadSmell
05-20-2009, 07:22 AM
Sorry for the late reply JohnnyRandom...
to much work getting in the way of my personal stuff :argh:

your scene looks like a really good start for me, I'm not giving this up on this! Scripting is defiantly my Achilles heal if you will,I just got bobos Pflow dvd to help me out.

So max reads the rotation in 90*....hmmm gona have a another try at this tonight

cheers

3DMadness
05-20-2009, 04:32 PM
Hey Alexander, I got a much simple solution. Create the first flow just to spread some particles over the tire's surface with the position object and the lock on emiter option, don't put a shape in this flow.
Then create a deflector and put it close to the tire's surface where you want your particles to be emited, link this deflector to the disk brake from mad car so it won't spin with the tire.
Now you just put a colision spawn and send it to another flow with the particles you want to generate, this way you'll see that the faster the wheel spin, more particles will be emited.

That's very simple but if you didn't understand something I can send you a simple test scene I made like this:

http://img.photobucket.com/albums/v494/Fla3DMadness/cgtalk/pflow-wheel.jpg

Cheers!

Flávio

HeadSmell
05-21-2009, 04:55 AM
Hay 3DMadness,

Yea I'm not follow the disk brake set up, If you can trow up a scene that would be cool.

My intentions where to use this with Fume in the pipeline. on a box WITHOUT after burn, so i don't have access to the the after burn operator to allow fume to apply to certain events, So emitting constant partials will make an undesired result with fume. That was my reasoning for birth script

3DMadness
05-21-2009, 01:34 PM
Humm... I've never worked with fume so I didn't know that... isn't there any way to apply fume onlye to certain events?

About the brake disk, I'm not with max right now, but I remember the mad car heve controllers for wheels and brake disk, this one will follow the wheel but will not roll, so that's why I would link the deflector to the disc brake controller from mad car.

CGTalk Moderation
05-21-2009, 01:34 PM
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.