# How do I: Attaching a geometry to a motion path

**URL:** https://forum.highend3d.com/t/how-do-i-attaching-a-geometry-to-a-motion-path/43788
**Category:** Maya
**Tags:** new-user
**Created:** [December 31, 2004, 7:58pm UTC](https://forum.highend3d.com/t/how-do-i-attaching-a-geometry-to-a-motion-path/43788 "2004-12-31T19:58:21Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![cockroach51](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/c/ee7513/32.png) [@cockroach51](https://forum.highend3d.com/u/cockroach51)
#### Post date: [December 31, 2004, 7:58pm UTC](https://forum.highend3d.com/t/how-do-i-attaching-a-geometry-to-a-motion-path/43788/1 "2004-12-31T19:58:21Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![joojaa](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@joojaa](https://forum.highend3d.com/u/joojaa)
#### Post date: [January 2, 2005, 12:12pm UTC](https://forum.highend3d.com/t/how-do-i-attaching-a-geometry-to-a-motion-path/43788/2 "2005-01-02T12:12:29Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![jtk77](https://forum.highend3d.com/user_avatar/forum.highend3d.com/jtk77/32/54731_2.png) [@jtk77](https://forum.highend3d.com/u/jtk77)
#### Post date: [January 2, 2005, 2:44pm UTC](https://forum.highend3d.com/t/how-do-i-attaching-a-geometry-to-a-motion-path/43788/3 "2005-01-02T14:44:09Z")

</div>

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

---

<div class="post-metadata">

### Author: ![joojaa](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@joojaa](https://forum.highend3d.com/u/joojaa)
#### Post date: [January 2, 2005, 4:13pm UTC](https://forum.highend3d.com/t/how-do-i-attaching-a-geometry-to-a-motion-path/43788/4 "2005-01-02T16:13:21Z")

</div>

Sorry mel is not my second language (yet) ![](http://www2.highendnet.com/forums/icons/wink.gif)

---

<div class="post-metadata">

### Author: ![cockroach51](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/c/ee7513/32.png) [@cockroach51](https://forum.highend3d.com/u/cockroach51)
#### Post date: [January 2, 2005, 8:50pm UTC](https://forum.highend3d.com/t/how-do-i-attaching-a-geometry-to-a-motion-path/43788/5 "2005-01-02T20:50:20Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![joojaa](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@joojaa](https://forum.highend3d.com/u/joojaa)
#### Post date: [January 2, 2005, 8:53pm UTC](https://forum.highend3d.com/t/how-do-i-attaching-a-geometry-to-a-motion-path/43788/6 "2005-01-02T20:53:31Z")

</div>

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)

---

<div class="post-metadata">

### Author: ![cockroach51](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/c/ee7513/32.png) [@cockroach51](https://forum.highend3d.com/u/cockroach51)
#### Post date: [January 2, 2005, 8:57pm UTC](https://forum.highend3d.com/t/how-do-i-attaching-a-geometry-to-a-motion-path/43788/7 "2005-01-02T20:57:47Z")

</div>

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”.

---

<div class="post-metadata">

### Author: ![joojaa](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@joojaa](https://forum.highend3d.com/u/joojaa)
#### Post date: [January 2, 2005, 9:04pm UTC](https://forum.highend3d.com/t/how-do-i-attaching-a-geometry-to-a-motion-path/43788/8 "2005-01-02T21:04:04Z")

</div>

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

---

<div class="post-metadata">

### Author: ![joojaa](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@joojaa](https://forum.highend3d.com/u/joojaa)
#### Post date: [January 2, 2005, 9:08pm UTC](https://forum.highend3d.com/t/how-do-i-attaching-a-geometry-to-a-motion-path/43788/9 "2005-01-02T21:08:32Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![joojaa](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@joojaa](https://forum.highend3d.com/u/joojaa)
#### Post date: [January 2, 2005, 9:18pm UTC](https://forum.highend3d.com/t/how-do-i-attaching-a-geometry-to-a-motion-path/43788/10 "2005-01-02T21:18:55Z")

</div>

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

---

<div class="post-metadata">

### Author: ![jtk77](https://forum.highend3d.com/user_avatar/forum.highend3d.com/jtk77/32/54731_2.png) [@jtk77](https://forum.highend3d.com/u/jtk77)
#### Post date: [January 3, 2005, 1:52am UTC](https://forum.highend3d.com/t/how-do-i-attaching-a-geometry-to-a-motion-path/43788/11 "2005-01-03T01:52:52Z")

</div>

Works fine here

---

<div class="post-metadata">

### Author: ![cockroach51](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/c/ee7513/32.png) [@cockroach51](https://forum.highend3d.com/u/cockroach51)
#### Post date: [January 3, 2005, 7:32am UTC](https://forum.highend3d.com/t/how-do-i-attaching-a-geometry-to-a-motion-path/43788/12 "2005-01-03T07:32:46Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![joojaa](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@joojaa](https://forum.highend3d.com/u/joojaa)
#### Post date: [January 3, 2005, 10:28am UTC](https://forum.highend3d.com/t/how-do-i-attaching-a-geometry-to-a-motion-path/43788/13 "2005-01-03T10:28:16Z")

</div>

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](http://www.hut.fi/~joojala2/highend/path.txt) 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!)

---

<div class="post-metadata">

### Author: ![cockroach51](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/c/ee7513/32.png) [@cockroach51](https://forum.highend3d.com/u/cockroach51)
#### Post date: [January 4, 2005, 7:51pm UTC](https://forum.highend3d.com/t/how-do-i-attaching-a-geometry-to-a-motion-path/43788/14 "2005-01-04T19:51:01Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![joojaa](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@joojaa](https://forum.highend3d.com/u/joojaa)
#### Post date: [January 4, 2005, 8:23pm UTC](https://forum.highend3d.com/t/how-do-i-attaching-a-geometry-to-a-motion-path/43788/15 "2005-01-04T20:23:41Z")

</div>

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.
