Atom Posted June 18, 2016 Share Posted June 18, 2016 (edited) I have a NULL at the object level moving along a path. I have another GEO object that pulls in a source mesh. I want that source mesh to follow the path as well. However, I am inside SOPs. I am looking for the VEX code that will transfer the NULL object matrix into the Translate, Rotate and Scale XYZ values of a Transform node at the SOP level. I can fetch the matrix from the object but I am not sure how to assign it? matrix m = optransform("obj/null_FOLLOWS_PATH", @Time); //rotate ( m, radians ( 20 ), { 0, 1, 0 } ); v@path_P *= m; Here is some pseudo code to demonstrate the intention of the code I am looking for. matrix m = optransform("obj/null_FOLLOWS_PATH", @Time); v@my_pos = m.extract_transform(); v@my_rot = m.extract_rotation(); v@my_scale = m.extract_scale(); Edited June 18, 2016 by Atom Quote Link to comment Share on other sites More sharing options...
f1480187 Posted June 18, 2016 Share Posted June 18, 2016 Try cracktransform function. cracktransform.hipnc Quote Link to comment Share on other sites More sharing options...
Atom Posted June 18, 2016 Author Share Posted June 18, 2016 (edited) Thanks F1, that is a great example file. I think the transform by attribute is the simplest for my needs. But the explicit code example is valuable as well. #include <math.h> #define XFORM_T 0 #define XFORM_R 1 #define XFORM_S 2 matrix xform = optransform("/obj/null1"); vector pivot = {0,0,0}; v@t = cracktransform(XFORM_SRT, XFORM_XYZ, XFORM_T, pivot, xform); v@r = cracktransform(XFORM_SRT, XFORM_XYZ, XFORM_R, pivot, xform); v@s = cracktransform(XFORM_SRT, XFORM_XYZ, XFORM_S, pivot, xform); Edited June 18, 2016 by Atom 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.