Introduction to Maya - Modeling Fundamentals Vol 1
This course will look at the fundamentals of modeling in Maya with an emphasis on creating good topology. We'll look at what makes a good model in Maya and why objects are modeled in the way they are.
# 1 19-03-2014 , 05:21 PM
Join Date: Dec 2005
Location: Toronto
Posts: 3,374

Delayed particle tracking

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?

# 2 19-03-2014 , 05:50 PM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
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.

Imagination is more important than knowledge.
# 3 19-03-2014 , 05:53 PM
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
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.

# 4 20-03-2014 , 06:46 PM
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
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?

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads