Jump to content

object along curve with correct orientation in SOPS


Recommended Posts

You'll need to have a normal 'N' attribute on the curve to start with.
The Path Utility tool creates such a curve.

Plus, you'll need to evaluate the position using primuv() a little bit ahead of the sampling position to get the direction vector.

n = primuv( using "N", at ulocation ) -> returns an up vector.
p0 = primuv( using "P", at ulocation ) returns the position.
p1 = primuv( using "P", at ulocation + 0.01 ) returns the position ahead.
dir = p1-p0;

then you can use the lookat vex function to build a rotation matrix.

So the trick is to get a good way to define the normal direction on the curve.

 

Edited by Guillaume
Link to comment
Share on other sites

1 hour ago, miccetro said:

Thanks pusat, I used it but my problem is how to make the rotation matix correctly for this and apply it to the object.

You can use maketransform VEX function and pass 2 of the vectors from PolyFrame depending on how you want the matrix to be oriented. This will give you a rotation matrix.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...