Post details: Align to Spline Xpresso

Align to Spline Xpresso

Xpresso - by:
January 29th, 2007

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

[More:]

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%)

14 response(s) to Align to Spline Xpresso

  1. Sulian [Visitor] says:

    Another good tip for Cinema4D.

    Thanks you

  2. Mallo [Visitor] says:

    Great!
    Thanks!

  3. the_Monkey [Visitor] says:

    You can also solve this by changing the spline interpolation from adaptive to uniform.

    -m

  4. Stefano [Visitor] says:

    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

  5. NOLT [Visitor] says:

    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

  6. base80 [Member] says:

    Pour un objet plus long je te propose de faire 2 align to spline espacé et de cibler le dernier sur le premier

  7. NOLT [Visitor] says:

    I am so stupid, didnt read the tuto until the end, my answer is just below, thankx a lot for everything !!

    nolt

  8. Edgard [Visitor] says:

    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

  9. Steve [Visitor] says:

    I get it to work if I use automatic keyframing...but it doesn't if I just hit the record button. Any ideas?
    Thanks

  10. Navstar [Visitor] says:

    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.

  11. base80 [Member] says:

    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

  12. Eden [Visitor] says:

    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! ;-)

  13. base80 [Member] says:

    I just tried and it does work. you need the tangent port connected to the Vector2Matrix and the Matrix2HPB to get the rotation.

  14. base80 [Member] says:

    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

Leave a comment

URLs, email, AIM and ICQs will be converted automatically.




authimage

Options:
(Line breaks become <br />)
(Set cookies for name, email & url)