Last active
May 20, 2024 20:31
-
-
Save Kif11/0674b75e8d6f90a4151539d67dc0f6bf to your computer and use it in GitHub Desktop.
Rotate flat geometry to X/Z plane. Houdini VEX.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Align object to target vector base on selected normal | |
// Useful when object has some weird orientation baked | |
// in the mesh and you wan to straighten it up. | |
// Point with normal from second wrangler input to align | |
vector from = point(1, 'N', 0); | |
// Allign "from" normal to the following vector | |
vector to = {0,1,0}; | |
matrix3 m = ident(); | |
float amount = acos(dot(from, to)); | |
vector axis = normalize(cross(from, to)); | |
rotate(m, amount, axis); | |
@P = @P * m; | |
@N = @N * m; |
Author
Kif11
commented
Jun 21, 2019
Thanks a lot. you save me
@yjsp93 glad it is useful.
It works very good, thx a lot!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment