How do I: Attaching a geometry to a motion path

I’ve searched the new user forums for about an hour now and haven’t found a solution that deals with this.

I have a spiraling sphere-shaped motionpath and I wish to attach a series of nurbs or polys to it (the finished intention is to have them appear along the path one by one so if anyone knows how to do this, it’s greatl appreciated!)

The big problem I have is that I can’t even seem to attach on geometry properly. When I try to play the animation the geometry goes to the center of the sphere and starts to spin instead of actually following along the motion path. How do I get the animation to actually follow the path, and bonus points to anyone who can actually tell me how to get a series of geometries to sucessively appear one after another along the path from top to bottom.

Thanks in advance for any help.

Paste into script editor and run in a empty scene. (even tough this is mel its derived form ui imputs by cut and paste, by looking at the reference one is able to reproduce this without writing a single line of mel)

{ // lets protect from global pollution (not neccesery in this case!)
// disable annoying warning
cycleCheck -e off;

//lets create the sphere
sphere -p 0 0 0 -ax 0 1 0
-ssw 0 -esw 360
-r 5 -d 3
-ut 0 -tol 0.01
-s 8 -nsp 4 -ch 1;

//and spiral on it
curveOnSurface -d 1 -uv 0 0
-uv 4 32 -k 0
-k 1 nurbsSphere1 ;

// object to be attached
cone -p 0 0 0 -ax 0 1 0
-ssw 0 -esw 360
-r 0.25 -hr 2
-d 3 -ch 1;

// attach object to curve on surface
// Note if we use curve on surface we can get rid of the limitation
// in wich curves flip, its a inheritted problem of mathematics
// governing this, this is just one way of solving it
pathAnimation -fractionMode 1
-follow 1 -followAxis x
-upAxis y -worldUpType “normal”
-inverseUp 0 -inverseFront false
-bank false -startTimeU playbackOptions -query -minTime
-endTimeU playbackOptions -query -maxTime
nurbsCone1 nurbsSphereShape1->curve1;

// lets do another a bit differently attached one
cone -p 0 0 0 -ax 0 1 0
-ssw 0 -esw 360
-r 0.25 -hr 2
-d 3 -ch 1;
pathAnimation -fractionMode 1 -follow 1
-followAxis y -upAxis x
-worldUpType “normal”
-inverseUp 0 -inverseFront 0
-bank false
-startTimeU (playbackOptions -query -minTime+playbackOptions -query -maxTime/10)
-endTimeU (playbackOptions -query -maxTime*1.1)
nurbsCone2 nurbsSphereShape1->curve1;

//lets make the second appear
setAttr “nurbsCone2.visibility” 0;
setKeyframe “nurbsCone2.v”;
currentTime (playbackOptions -query -minTime+playbackOptions -query -maxTime/10);
setAttr “nurbsCone2.visibility” 1;
setKeyframe “nurbsCone2.v”;
currentTime playbackOptions -query -minTime;

//lets hide the ball and path to reduce clutter
setAttr “nurbsSphere1.visibility” 0;
} //lets end scope
//now press play and se what happens

Hope this helps.

thats awsome, you should answer everything in code haha. thanks man I like this.

Sorry mel is not my second language (yet)

Am I supposed to paste everything in that? (IE The orange and yellow text) into the script editor? Then what do I do? It didn’t seem to do anything.

paste it, select evreything (ctrl-a) and hit the numpad enter to execute it. (or choose cript execute, or hit control-enter [the regular enter] but i do suggest using the numpad enter)

I copied/pasted all the orange/yellow text into the script editor and hit enter and recieved the message: Error: Invalid use of Maya object “yellow”.

Howcome you se the UUB tags tags inside []? you shouldnt, and whan i copypaste they dont appear! What browser do you use.

Its actualy important because that might indicate the forum is breaking down. Or thet you have soem wierd uub avare browser plug isntalled

okay now thats plain wierd.

Anyway the mel code actualy is just a shorthand transcript of what i did you shoudl be able to follow everything else except the subcurve placement by reading what options i used for what commands and so forth.

tested this code pasting form links, lynks, moziilla and IE worked fine on all of them.

Works fine here

If I remove all the comments that appear in that script should that make it work? I tried this but it still seems to be having the same problem. Perhaps I am on the correct track though. Did you write this script yourself or find it somewhere?

I copypasted my actions. So yes i worte it myself. It works fine. Ive tested it atleast 20 times. Are you perhaps on macintosh, as it might explain a LOT.

What is the exact error do you get? Anyway your earlier error seem to inidicate you somehow have a uub aware browser. Or then you cut and paset with some strange means.

Have never ever encountered a person who has problems in copypasting working script. oh well Try this instead.

Id think you have succeded in not pasting one of the { } brackets at either end (as indeed ie has trouble copypasting it if you select from first down but not from down up go figure!)

Thank you.

I’m not sure this animation is exactly what I’m looking for, but it is very close. Is there a way to change the shape somewhat of the path the two objects are following? And is it possible to add (many) more objects?

yes, just modify the path or object just attach thing to path.

Select object to attach then Path tp attach to and choose anim menuset-> animate → motion path → attachg to motio path optionbox and set the values you need such as different ed start time.