PDA

View Full Version : trail dust with velocity


hto
04-01-2008, 09:04 PM
Hello there,

I have a car, which is on the desert, and as the car is moving a dust trail is being emitting..

How can I calculate the emission rate, depending of the car velocity?.

is the emission rate would have to be linked to the car's velocity so it doesn't emit when it's not moving, and emits less when it's moving slowly..

Thanks for you hints.

hto

phildog
04-02-2008, 04:59 AM
Hi

make the car, or something in the car or better yet parent something under the car so its under the wheels.

make it into a passive rigid body

from there

put this expression (or similar into the emitter)

vector $vels = `getAttr rigidBody1.velocity`;
//change rigidBody1 to the name of your rigid body node
rate = mag($vels);

hope that helps


now go and join my site ! :p

www.modernmayhem.com

Hello there,

I have a car, which is on the desert, and as the car is moving a dust trail is being emitting..

How can I calculate the emission rate, depending of the car velocity?.

is the emission rate would have to be linked to the car's velocity so it doesn't emit when it's not moving, and emits less when it's moving slowly..

Thanks for you hints.

hto

Aikiman
04-02-2008, 05:53 AM
Hey Phildog, i wrote virtually the same script except the first line of code...

vector $rigidVel = `rigidBody -q -velocity rigidBody1`;

which works also, would there any difference in performance between yours and mine?

Or more like...which is the more common way to write it...

cheers

phildog
04-02-2008, 06:08 AM
Hi Jeremy! yeah maybe your way would be better. since it seems to read directly from the node. rather than use a generic getAttr.


Hey Phildog, i wrote virtually the same script except the first line of code...

vector $rigidVel = `rigidBody -q -velocity rigidBody1`;

which works also, would there any difference in performance between yours and mine?

Or more like...which is the more common way to write it...

cheers

Aikiman
04-02-2008, 07:26 AM
ok cool, ill take your word for it. ;)

hto
04-03-2008, 01:23 AM
Thanks guys, for your help..

I did apply the expression to the emitters. and did

vector $vel = `rigidBody -q -velocity rigidBody1`;
print $vel;
smoke2.rate = mag($vel)*100;

I had to do times 100, because the emissiton rate was 0.XXX something..

When the car starts riding no emission happend until, frame 74.. here the expression seems to work well.

Any idea why doesn't work as the car starts?..

Thanks, and cheers..

hto

Aikiman
04-03-2008, 01:52 AM
Not sure but do a print to check if there is velocity before then. You may need to write an if statement saying if the frame is zero then reset emitter rate to zero also.

hto
04-04-2008, 01:43 AM
Thank, man... is working now...
Cheers..
Hto

if (frame >= 12)
{
vector $vel = `rigidBody -q -velocity rigidBody1`;
//print $vel;

smoke2.rate = mag($vel)*50;
//float $smkRate = `getAttr smoke2.rate`;
//print $smkRate;

}
else
smoke2.rate = 0;

hto
04-16-2008, 02:05 AM
hello there,

days ago this scene was working nicely, but I imported the scene file to a different scene and stop woking. actually this line stop working.

vector $vel = `rigidBody -q -velocity rigidBody1`;

I've been checking frame by frame, and the velocity is always <<0,0,0>>

Does any body knows why this could happened?.

Cheers.

hto

phildog
04-16-2008, 02:07 AM
theres a name hard coded in there

rigidBody1

perhaps that has something appended to it now. like

scenename:rigidBody1 instead

go to outliner, turn off display dag objects only and have a look



hello there,

days ago this scene was working nicely, but I imported the scene file to a different scene and stop woking. actually this line stop working.

vector $vel = `rigidBody -q -velocity rigidBody1`;

I've been checking frame by frame, and the velocity is always <<0,0,0>>

Does any body knows why this could happened?.

Cheers.

hto

hto
04-16-2008, 03:11 AM
hey Phildog,

I just checked, no I dont have something appended to the name.

Aikiman
04-16-2008, 03:53 AM
maybe the rigidbody node on the passive dropped off.......try creating a new passive rigid.

hto
04-16-2008, 08:38 AM
hello Aikiman,

Yes I did, but I got the same result....I dont really have any idea why this is happening..

or how can I work around to calculate another velocity.

thanks man for you suggestion.

hto

Aikiman
04-16-2008, 10:42 PM
hto,

Im not sure mate, can you post the scene up? It seems strange that it doesnt work since theres nothing wrong with the code as you know. I would rewrite the code and dynamics again, try using getAttr maybe.

hto
04-17-2008, 11:48 PM
yes it was... but I finally solve. I dont know why but I got this wierd characters on my translation and rate attributes, something like this.. 1.Q#0

What I did, I just deleted the rigidbody and create a new one. and now works fine.

Thanks man, for your help and time..

Cheers.

hto.

CGTalk Moderation
04-17-2008, 11:48 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.