| Item | Quantity | Price |
|---|
| Your cart is empty. Check out our collection of 3d models! |
Prices in:
Clear Cart
You can modify the "getAttr" command with the -time flag to get attributes at the specified time. This however works only if the attribute itself is driven by keyframes, constraints or valid expressions, means containing no mel syntax.
in this case it would look like
int $currentTime = frame;
// or: int $currentTime = `currentTime -q`;
float $p[] = `getAttr -time ($currentTime + 1) "pCube1.translate"`;
// now since the expression already is "downgraded" to mel you can feed the locators translate attribute in one go
setAttr "locator1.translate" $p[0] $p[1] $p[2];
// or: move $p[0] $p[1] $p[2] "locator1";
// or: xform -worldSpace -translation $p[0] $p[1] $p[2] "locator1";
>> // now since the expression already is "downgraded" to mel you can feed the locators translate attribute in one go
No theres still one dsiadvantage to doing this over the expression syntax! And tahst that the data goes to the undo stack that can totally wreck your mayta experience. So still use expressions going out:
locator1.translateX=$p[0];
locator1.translateY=$p[1];
locator1.translateZ=$p[2];
Just because something is broken dont mean you should break things even more! And No the users will not appreciate you rigging so thay can not meaningfully undo anymore. No need to slow things down extra just so you can save 2´lines of typing especially whan its just a copypsate and its faster to run.
hi,
I'm a MEL newbie and I need to position a locator at the place where another object will be in 2-3 frames. Any Ideas?
I know this might be real simple, but I haven't been able to figure it out yet.
Thanx.
I understand the basic principle, but how do I go about doing this?
Lets say the object I want to drive the position of the locator is pcube1 and I want Locator1 to always be at the position of pcube1 at frame+1, what's the code I need to put into the expression editor of Locator 1?
(Like I said, I'm a scripting newbie...)
Thanks for your help.