FORUMS: list search recent posts

Re: Check this out

COW Forums : MAYA

Return to posts index   •   Read entire thread

Re: Check this out
on Oct 15, 2002 at 9:50:36 pm

Rob, I copied your data and was able to duplicate your results (oscillating discrepancy, usually near the negative X axis).

After poking around for a little while, I think I have the answer, if not the solution, to your problem.

The culprit seems to be the 'SetKeyPath' command. As you know, what it does is add spacetime markers (xyzt) to an existing path, or create a new path if the selected object has none. The problem arises due to the fact that by default, it will create a NURBS curve of degree 3 and then try to fit that as closely as possible to any new points, yanking CVs around as necessary to make things fit.

Incidentally, have you ever watched Maya create the curve? --Setting my Front camera to an Orthographic Width of 1500 allowed me to watch the process unfold and that's what first tipped me off about what's happening.

Your data has minor offsets from a perfect circle, I suppose... either that or rounding errors introduced as Maya processes your data creep in, or something of the sort. The upshot is that, as Maya continues to try to add points to your motion path, a feedback loop gets set up whereby the curve starts to swing wildly back and forth as it tries to match up precisely with all the points.

Think about a driver who loses control and tries to straighten the vehicle out, only to overcorrect and swerve the other way... this repeats and if the variables are just right, the amplitude increases. Finally, the curve is swinging so wildly about the circle that Maya is unable to connect it to the actual markers (your data points), so it is forced to move those data points to the closest place on the curve. This is evidenced by the fact that the 'print $time $line $f1 $f2 $f3' output is correct (ie. it describes points on the circular orbit), but differs from the actual locations of the corresponding markers.

Here are a couple of directions that you might explore to find solutions.

First of all, I noticed that if I run your script, then run it again, the curve seems to 'fix' itself. Apparently the conditions for the feedback loop only exist when there's no curve ahead of the current point. So you could run the script twice and let it iron out its own wrinkles. Unfortunately, this is very slow to do. (Oh, and speaking of speed... I noticed that by default, the position markers on the path are left visible, and this really hammers interactivity. Getting the script to run faster might involve keeping those from showing up, or hiding them as soon as they do. For example, adding the line 'hideShow -posMarker -hide;' to hide all markers after evey SetKeyPath cut my processing time in half. But that seems a sloppy way of doing it; I'm sure there's something better. Also, the effectiveness of that might be vidcard dependent.)

Second of all, you could make the path linear instead of degree 3. This way there is no interpolation between points, so no feedback loop. Plus calculation is much faster. Of course, the nature of your project might mean that this level of detail is not sufficient. I don't know if there's a solution to this; perhaps you could rebuild the curve to degree 3 afterwards? I don't know what this would do to the position/precision of the markers. If you want to try this approach, what you have to do is manually create a linear curve and attach the NEP object to that as a motion path BEFORE you run your script. Then the script will append points to the linear curve and all will be well... if somewhat faceted.

Good luck!


Posts IndexRead Thread

Current Message Thread:

© 2018 All Rights Reserved