Align to Spline Xpresso

Sometimes things go horribly wrong. You want to align an object on a growing Sweep NURBS.
When you use the Align to Spline Tag you can have the following result.
The object is not synchronous with the growth, Grr!

align-not-good

The solution is to make an simple xpresso that replaces the Align to Spline Tag

Follow up:

My model is very simple to illustrate the case.
I have a Sweep NURBS with a free form spline in it. The Sweep NURBS "grows" from 0% to 100% in 90 frames.
I have a Sphere (called Target) following the spline with an Align to Spline Tag set from 0% to 100% in 90 frames.
And I have trouble...

The trouble is caused by the type of spline and the interpolation, but my design does not permit to modify those settings.

Ok lets get started. Delete the Align to Spline Tag.
Add an Xpresso tag.
Drag the Spline and the Sphere in the xpresso editor.
Now add a "Spline-Node" from the general xpresso nodes to the editor.
The node has 3 visible ports, on the left you have the object and Offset port, on the right you have the position port.
Connect the left Object port back to the right Object port of your Spline.
Connect the right Position port to the left Position port of the Sphere.

Click on the Spline node and go to the Attribute Manager
Now you can set the Offset from 0% to 100% in 90 frames.
AND, here it comes... check the "Use Natural Distribution"

align-xpresso

Tadaa It should work fine now

align-good

Lets take this one step further. we want to make the object tangential to the spline.
Start by opening the Tangent port on the Spline node.
Don't ask me why I do the following steps... it just works.
Add a Vector2Matrix node and a Matrix2HPB and connect them as in the following image

align-tangent

This will point your object in the direction of the spline.
Xpresso is like magic!

align-tangent

Enjoy!

Oh By the way, this xpresso makes it possible to go round and round and round... The Align to Spline Tag is limited to one full circle (100%)

26 comments

Comment from: Sulian [Visitor] : 2007-01-31 @ 22:19
Another good tip for Cinema4D.

Thanks you
Comment from: Mallo [Visitor] : 2007-02-06 @ 02:01
Great!
Thanks!
Comment from: the_Monkey [Visitor] : 2007-02-14 @ 08:34
You can also solve this by changing the spline interpolation from adaptive to uniform.

-m
Comment from: Stefano [Visitor] : 2007-03-29 @ 14:54
You're Magic, but I have a impossible problem: a object on a spline( with the tag align to spline) and a deformer (wind or formula or what you want), child of the spline. The object don't move on the deformed spline but follow a flat trajectory. Whyyyyyy?????? There is a solution? Or not? excuse my poor english
Comment from: NOLT [Visitor] : 2007-04-16 @ 13:13
Hello Base80

merci pour tous tes tuto

j'ai une petite question par rapport a celui la
si tu changes ta boule par un cylindre, et dans mon cas par un jack audio
comment fais tu pour que le jack suive la trajectoire en tournant comme elle, je veux dire pour que le jack soit aligné du debut jusqua la fin dans le bon sens avec ta spline ?

merci
Comment from: base80 [Member] Email : 2007-04-16 @ 13:20
Pour un objet plus long je te propose de faire 2 align to spline espacé et de cibler le dernier sur le premier
Comment from: NOLT [Visitor] : 2007-04-17 @ 16:45
I am so stupid, didnt read the tuto until the end, my answer is just below, thankx a lot for everything !!

nolt
Comment from: Edgard [Visitor] : 2007-12-25 @ 12:56
Hello, thanks for the tutorial, i try to take it to the next level so i try it out with a star shape as my target , so the target is following the direction of the path but it also rotated in H my star shape which i was gonna texture, any solution with that?Gracias
Comment from: Steve [Visitor] : 2008-04-18 @ 20:35
I get it to work if I use automatic keyframing...but it doesn't if I just hit the record button. Any ideas?
Thanks
Comment from: Navstar [Visitor] : 2008-08-06 @ 05:27
Two questions:
In 10.5, Vectors2Matrix has four inputs (offset, v1, v2, v3) rather than the one input in your example. What should I do?

I know 10.5 HUD makes this question somewhat irrelevant, but how do I get one of those nice Xpresso user data sliders? I hate having to open up the Xpresso Editor when I want to make offset changes.
Comment from: base80 [Member] Email : 2008-08-06 @ 11:41
it is not vectors2 matrix but vector2matrix node, there is a little "s" in the one you used

for userdata sliders there is a turorial on this site
Comment from: Eden [Visitor] : 2008-08-26 @ 22:13
Does this trick not work with Splines that are set to Linear and have 90º angles? I tried this method using a spine as described and it refuses to point in the right direction! ;-)
Comment from: base80 [Member] Email : 2008-08-26 @ 22:37
I just tried and it does work. you need the tangent port connected to the Vector2Matrix and the Matrix2HPB to get the rotation.
Comment from: base80 [Member] Email : 2008-08-26 @ 23:48
Thanks for your file Eden.
The problem is like the Gimbal lock.
The trick to get rid of this the dirty way is to add some points that you move very slightly outwards, this way the rectangle has more direction
Comment from: craig zuckerman [Visitor] · http://www.craigzuckerman.net : 2008-09-03 @ 23:53
great tut!-question, I got this to work,BUT, how do I make my object go around several times?,I am using V10, also what if I want to make my object rotate, as well?, thanks so much in advance, Bets, CZ
Comment from: base80 [Member] Email : 2008-09-03 @ 23:56
Craig have a look at my BPM RPM nodes
Comment from: Damien [Visitor] : 2008-09-23 @ 16:36
*****
Just passing by to say that the little animated preview made me laugh. It remembered me all the times I was trying to do something simple, but ran into annoying problems just like this one. I espescially like the little "Grr!" showing in this preview. :D
Comment from: René [Visitor] · http://www.pointlessproductions.es : 2008-11-14 @ 14:45
*****
Hi there!!!

Great tutorial, congratulations for the web, it is very helpful to start messing around with xpresso!! By the way i´ve taken this tut one step further but, i can´t find the Tangent port?? Where is located??

Thx in advance!!

René.
Comment from: base80 [Member] Email : 2008-11-14 @ 14:57
The tangent stuff is in the tutorial. the port is on the Spline-node
Comment from: 2b1 [Visitor] : 2009-02-13 @ 09:32
I only get uniform distribution as a selection, how do I get it natural? Thanks in advance!
Comment from: Si [Visitor] · http://www.simontibbs.co.uk : 2009-04-02 @ 23:12
*****
I have wasted a whole day trying to find a way of fixing this! Many many many thanks, and awesome diagram. The GRRR is extremely relevant!

Thaks again!

Si
Comment from: phisee [Visitor] : 2009-05-10 @ 13:29
****-
I get Gimbal Lock on some points. Is there a way to avoid this?
Comment from: Bas [Visitor] : 2009-07-17 @ 14:39
*****
Great tutorial.
What now if I want to add two more instances and follow with an offset (and still stay tangentially correct)?
Building a rollercoaster and I haven't found a satisfying answer anywhere yet.
thx
b a s
Comment from: base80 [Member] Email : 2009-07-17 @ 14:50
do the tutorial twice! :-)
Comment from: Bas [Visitor] Email : 2009-07-21 @ 16:00
Ehm, that wouldn't let me animate cart 1 and automatically make cart 2 and three follow.
Also if cart 1 is at position 0%, cart 2 and 3 are not allowed to go to position -3% and -6% for example, so they stay at the right distance. And those two extra carts would use the tangent of cart 1, so it will go horribly wrong. (I think... right?)
It would also be nice to bypass the 0 to 100% and make it go 0% to 1000% for example...
Comment from: paul [Visitor] Email : 2009-07-31 @ 23:03
I'm just starting with xpresso and I'm trying to get this tutorial to work with a second spline that controls the B rotation angle of the cube. My idea is to duplicate the spline that the object is following to make the "rail". Then, I'll drag the points of the rail up or down in the Y axis to control the "banking" with say a positive Y value between the main spline and the rail spline make it bank left and a negative value makes it bank right.
Can anyone help with this, please? Please be as specific as possible because I really don't know much about how Xpresso works.

If there's a better way to do it, I'm open to non-xpresso options, too.
Thanks.

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
PoorExcellent
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)
This is a captcha-picture. It is used to prevent mass-access by robots.
Please enter the characters from the image above. (case insensitive)