CGTalk > Software > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 07-01-2013, 02:32 PM   #1
Gnimmel
Frequenter
Richard Cheek
Technical animator
Freelance-Animation
USA
 
Join Date: Jan 2004
Posts: 284
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
http://www.freelance-animation.com
Personal project : The Goblin Abyss
 
Old 07-02-2013, 04:14 AM   #2
palohman
Frequenter
portfolio
Paul Lohman
Tech Artist
EA
Orlando, USA
 
Join Date: May 2004
Posts: 144
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
__________________
blogfolio
 
Old 07-03-2013, 11:52 AM   #3
haggi
Expert
3d freelancer
 
Join Date: Apr 2004
Posts: 955
Have a look at the frame cache node, maybe it could do the trick.
__________________
www.renderwiki.com - www.openmaya.net
 
Old 07-04-2013, 04:27 AM   #4
palohman
Frequenter
portfolio
Paul Lohman
Tech Artist
EA
Orlando, USA
 
Join Date: May 2004
Posts: 144
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.
__________________
blogfolio
 
Old 07-05-2013, 04:49 AM   #5
palohman
Frequenter
portfolio
Paul Lohman
Tech Artist
EA
Orlando, USA
 
Join Date: May 2004
Posts: 144
https://www.box.com/s/anikbzfmy9kef9nrykkh
this is my first proper maya plug-in,
it's a trail with no overshoot type "constraint",

SMAConstraint.py (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
__________________
blogfolio

Last edited by palohman : 07-06-2013 at 02:34 AM.
 
Old 07-08-2013, 02:31 PM   #6
Gnimmel
Frequenter
Richard Cheek
Technical animator
Freelance-Animation
USA
 
Join Date: Jan 2004
Posts: 284
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
http://www.freelance-animation.com
Personal project : The Goblin Abyss
 
Old 07-08-2013, 11:41 PM   #7
palohman
Frequenter
portfolio
Paul Lohman
Tech Artist
EA
Orlando, USA
 
Join Date: May 2004
Posts: 144
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.
__________________
blogfolio
 
Old 10-09-2013, 09:27 AM   #8
strarup
Know-it-All
 
strarup's Avatar
Alex V. U. Strarup
R&D
Denmark
 
Join Date: Jan 2003
Posts: 382
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
http://www.strarup.net/maya/plugins/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.
http://www.youtube.com/watch?v=X1zqfkB6RP0
and here yo can see the attributes of the frameCache node. (also in the maya help file)
http://download.autodesk.com/us/may...frameCache.html


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
Strarup
__________________
Alex V. U. Strarup
Mel script monkey
Facebook LinkedIn


one mistake can ruin it all... :)
 
Old 10-09-2013, 09:27 AM   #9
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,481
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 11:49 AM.


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