PDA

View Full Version : instance animation change by particle speed


Halford
09-01-2010, 12:14 PM
Hi,

I remember seen this long time ago, but can't find it any more...

I have a bunch of animated fishes that are swimming. it's a particles system with instanced shapes.

I would like to find a way that the animation changes speed as the particles accelerate or decelerate.

in two words I'ld like to swim faster when the particles goes faster and vice versa....

if you know how or can point me to a way of doing it, it would be great.

Thanks.

Hal.

PS: I remember a scene with crabs...they changed speed/animation speed with a script.

JohnnyRandom
09-02-2010, 06:07 AM
This is assuming you are running a looped out-of-range type animation.

You can use the Particle Age keyframe offset in the Shape Instance operator. What you would do is something like this:

Get the Speed Magnitude of the particle (more than likely it would be something in the range of 0.02 to 0.09)
Multiply it by something like 100.0 so you get a more usable value for use with time by frames
Get the current particle age and add the Speed magnitude value to that.

A script operator might look something like this:

on Proceed pCont do
(
count = pCont.NumParticles()

for i in 1 to count do
(
pCont.particleIndex = i
speedMagnitude = (length pCont.particleSpeed)*100
adjustedAge = pCont.particleAge + speedMagnitude
pCont.particleAge = adjustedAge
)
)


EDIT: Here is an example: http://www.vimeo.com/14630847

Halford
09-02-2010, 07:58 AM
That's exactly what I was looking for..thank you for the help!

and Thank you for the video :)

Hal.

CGTalk Moderation
09-02-2010, 07:58 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.