miccetro Posted June 8, 2016 Share Posted June 8, 2016 Hi community, I'm trying to use the primuv vex function to move an object along a curve in sops and have it correctly oriented as well. Any ideas? I've attached a hip file. Thanks. obj_along_path_SOPS_01.hip Quote Link to comment Share on other sites More sharing options...
Guillaume Posted June 8, 2016 Share Posted June 8, 2016 (edited) 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 June 9, 2016 by Guillaume Quote Link to comment Share on other sites More sharing options...
miccetro Posted June 8, 2016 Author Share Posted June 8, 2016 Thanks for responding Guillaume, if you could send a file that would be great. Quote Link to comment Share on other sites More sharing options...
animatrix Posted June 8, 2016 Share Posted June 8, 2016 PolyFrame SOP is a good way to create normal, tangent and bitangent vectors. Quote Link to comment Share on other sites More sharing options...
miccetro Posted June 8, 2016 Author Share Posted June 8, 2016 Thanks pusat, I used it but my problem is how to make the rotation matix correctly for this and apply it to the object. Quote Link to comment Share on other sites More sharing options...
6ril Posted June 8, 2016 Share Posted June 8, 2016 3 hours ago, Guillaume said: dir = p1-p1; I guess you meant dir = p0 - p1 Quote Link to comment Share on other sites More sharing options...
animatrix Posted June 8, 2016 Share Posted June 8, 2016 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. Quote Link to comment Share on other sites More sharing options...
Guillaume Posted June 9, 2016 Share Posted June 9, 2016 20 hours ago, 6ril said: I guess you meant dir = p0 - p1 yes! Quote Link to comment Share on other sites More sharing options...
miccetro Posted June 10, 2016 Author Share Posted June 10, 2016 Thanks everyone, @petz provided some wonderful solutions, just in time too super amazing! Thanks petz. Here's the file with solutions. obj_along_path_SOPS_02.hipnc 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.