Jump to content
Sign in to follow this  

Extract Transform VEX Variant

Recommended Posts

I'm trying to replicate the 'align' node with VEX.

What I'm looking for is simple matrix transform extraction with few reference point positions.


The goal is to calculate a rotation/translation matrix from between the actual geo and rest.


Thanks in advance.

Edited by schiho

Share this post

Link to post
Share on other sites
vector p = point(0,"P",0); // pivot position
vector u = set(0,1,0);
vector n = normalize(v@v);
vector o = cross(u,n);
matrix3 m3 = set(o.x, o.y, o.z,
                 u.x, u.y, u.z,
                 n.x, n.y, n.z); //3D Rotation Matrix

matrix m4  = set(o.x, o.y, o.z, 0,
                 u.x, u.y, u.z, 0, 
                 n.x, n.y, n.z, 0,
                 p.x, p.y, p.z, 1); //3D Transformation matrix

If you dont have any vectors then you can build it using 3 points reference. Let me know if you need help for this too






Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this