PDA

View Full Version : Delayed particle tracking


stwert
19-03-2014, 05:21 PM
I'm trying to constrain a locator to a particle, but no matter what I attempt, the locator is always trailing the particle by one frame.

I have tried to use a normal expression of the type:
vector $position = `nParticle -at worldPosition -id 0 -q targetParticleShape`;

loc.translateX = $position.x;
loc.translateY = $position.y;
loc.translateZ = $position.z;

And I have tried putting the evaluation after dynamics by doing something like this in the particle expression Runtime after dynamics:
vector $partPos = targetParticleShape.position;
float $xPos = $partPos.x;
float $yPos = $partPos.y;
float $zPos = $partPos.z;

loc.translateX = $xPos;
loc.translateY = $yPos;
loc.translateZ = $zPos;

But they all come to the same thing... the locator is delayed by a frame and is not fully constrained to the particle position.

Basically if I pause the sim and evaluate the particle position query it comes out as a different value as the current translate of the locator. It must be possible to make these equal.

Any thoughts?

NextDesign
19-03-2014, 05:50 PM
Not off the top of my head, and I don't have an installation at the moment to test something out, however you could try using a particle to curve path script, then attaching the locator to it via a motion path. It should work as long as your particle has constant velocity.

stwert
19-03-2014, 05:53 PM
Thanks ND, that might work. Unfortunately the locator actually will end up influencing the sim itself, so it kind of needs to happen on the fly, otherwise I would cache the sim and do a similar hack to get it in the right place at the right time.

stwert
20-03-2014, 06:46 PM
So the resolution of this ended up being that I just ignored the delay for the simulation and decided not to have the locator's downstream effects influence the simulation. Then when I cached the simulation, the locator "caught up" and there's no longer a delay. It's kind of strange, but I assume that using the cached simulation allows Maya to put the proper information at the proper time because it knows what will happen on a given frame?