How? Make particle return to worldPosition


#1

Hallo,

Im not great at MEL, and spend way to much time on figuring stuff out. What I would like to achieve: Iv got particles floating around in the scene, driven by forces.
I would like to query the world positions and velocity of the
particles on a certain frame, say frame 50.
Then on frame 450 I would like the particles to return to
the positions and velocity they were at frame 50.
So far I have only tried to get them back to the positions of frame 50, with out any success.
What I have is:

vector $gPP = <<0,0,0>>;
float $currentTime = currentTime -q;
if ($currentTime == 50){
getAttr particleShape2.position;
$gPP = particleShape2.position;
//print $gPP;
}

if ($currentTime == 450){

 particleShape2.position = $gPP;

}
Can you please tell me if I`m on the right track, and give my a nudge in the right direction.

Thanks
Jakes


#2

Are you doing this in the particle expressions editor, or somewhere else?
if it’s the expression editor, then you should be aware that local variables like your $gPP are reinitialized for every particle for each frame, so it doesn’t store you value once the current particle is done. In order to do that you should do this:

  1. create a vector per particle attribute on the particle shape (i.e. posStorePP)
  2. in your runtime expression paste this:

  if (frame == 50) posStorePP = worldPosition;
  if (frame == 450) position = posStorePP;
  

#3

Thanks Azrail,

Ill try this first thing in the morning. Just after I posted I realized that I should have worked with.worldPosition.And then interestingly enough I came across.worldParticlePositionreading tonight, will do some research on it. What I basically need to achieve is a bunch of bacteria like organisms thats going to be projected on the Barberton rock in a museum. The bacteria needs to wiggle and move around over the rock and every now and then it needs to attract to a goal to briefly form a fossil like structure <like those fossilized worms and bugs you get>
Everything works fine except after I form the fossil like structure I can not get my particles to integrate back into the picture to wiggle around over the screen again to get ready to form the next fossil.

Cheers
Jakes


#4

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.