Lag expression in real time

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  07 July 2013
Lag expression in real time

I'm trying to make a real time object trail using an expression and I can't get it to work in real time and hope someone has a few suggestions I've missed.

All the expression needs to do is copy the translate and rotation from one object to another, but back in time. In the expression I can only do this with a getAttr using the time flag, but that stops it working in real time. If you move the object, it's trail objects don't update until the time line is scrubbed.

Anyone have any thoughts on a better way to do this?
Richard Cheek
Personal project : The Goblin Abyss
  07 July 2013
the -alwaysEvaluate(ae) flag for expression says:
"If this is TRUE (the default), then the expression will be evaluated whenever time changes"
So I don't think you can do it with an expression.

I don't think there's any continuously firing event or condition to use scriptJob.

I'm doubtful that there's any node graph that you could construct that would drive one node by another in a drag behind sort of way.

I think the only way to do it would be a custom constraint.

see geometrySurfaceConstraint.cpp in the dev-kit, though what you want should be simpler
  07 July 2013
Have a look at the frame cache node, maybe it could do the trick.
__________________ -
  07 July 2013
Ok, i'm pretty close to having a simple moving average constraint(still working out some bugs), but it's worth asking at this point
What specifically were you looking for;
A. Trailing - follows but no overshoot
B. Ghosting - goes to exactly the same position the parent did n updates ago
C. Secondary Motion - springy follow, has overshoot

Another consideration is when to stop updating. Most constraints would stop computing when the input stops changing. Like for a point constraint, parent moves, compute output position, parent stops, stop computing.
In just about any case but the ghosting solution, you'd want to keep computing until the delta met a threshold.
  07 July 2013
this is my first proper maya plug-in,
it's a trail with no overshoot type "constraint", (Simple Moving Average)
put the file in a plug-in path and load it
createNode SMAnode; or in the hypershade menu->Create->General Utilities->SMAnode
-connect your parent translate/rotate to the SMAnodes input.
-connect the SMAnodes output to your childs translate/rotate.
-adjust the Lag Length attribute in the SMAnode to increase or decrease the "lag"
-move the parent node around

Know Issues:
-rotation behaves unexpectedly because I'm not properly handling angle maths
-translation and rotation are local space only, no matrix transform
-animation/time change does not affect it only real-time changes
-decreasing the lag length has unexpected results
-multiple instances of the node probably has unexpected results

Last edited by palohman : 07 July 2013 at 02:34 AM.
  07 July 2013
Sorry for the late reply, thanks to the 4th I haven't been in front of my computer for a few days.

palohman; thanks for taking a look at this. Your plug-in seems to work great, although it's not quite what I'm looking for. I need a exact copy of the old position more like train cars on a track, however it's given me some other ideas. I'm now thinking this is possible, although originally I didn't want a plug-in because it will be used on a rigs that are sent out to freelancers, but if that is the only way to achieve this, then I'm fine with it.

Thanks again.
Richard Cheek
Personal project : The Goblin Abyss
  07 July 2013
Doing the exact match back in time(ghosting) should be easier.
I do have some ideas on the how to fix some of the known issues.
Will keep you updated.
  10 October 2013
Hi Richard,

as Haggi wrote earlier, you can use the FrameCache node, you just need 6 nodes for every object, if you want to have the x,y and z for transform and rotation.
though i still wonder if Autodesk, hasn't been implementing something like the lagnode
as i created that plugin back in 2004, so strange if they haven't done it, as you then only need one Node, instead of 6.

but back to the frameCache Node, here is a video tutorial about framecache node.
and here yo can see the attributes of the frameCache node. (also in the maya help file)

if you don't want to use a plugin but have it scripted, then frameCache node is a good option.

hope that helps a bit. :-)

kind regards
Alex V. U. Strarup
Mel script monkey
Facebook LinkedIn

one mistake can ruin it all... :)
  10 October 2013
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 01:51 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.