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!

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"

Tadaa It should work fine now

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

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

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%)
29 comments
-m
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
nolt
Thanks
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.
for userdata sliders there is a turorial on this site
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
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é.
Thaks again!
Si
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
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...
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.
PS: Sorry for my english =)
try the last part again and check that the nodes are exactly the same (some look similar to others)