Calculating a matrix to move it back to the origin...

   2200   4   0
User Avatar
Member
27 posts
Joined: Aug. 2013
Offline
I calculated a matrix, but the inverting the matrix moves it to the origin by the rotation is messed up..

would so appreciate if someone took a look at what i am doing wrong ...

cheers




Image Not Found

Attachments:
calcmatrix_question.hipnc (352.3 KB)

User Avatar
Member
4544 posts
Joined: Feb. 2012
Online
Hi,

You should normalize your Y vector:

vector Y = normalize ( cross(X,tmp) );

You can also construct your matrix using maketransform function:

maketransform ( Z, Y, center );

For the center, you can also use the primitive's center:

primuv ( 0, "P", @primnum, 0.5 );

Other than these, the result looks correct.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
User Avatar
Member
27 posts
Joined: Aug. 2013
Offline
hey @animatrix . thanks for the reply.. i did take your suggestions.. but when i apply the inverse matrix.. the pighead's orientation is off from the default. i was hoping to restore the default orientation.

thanks again. cheers
User Avatar
Member
34 posts
Joined: Sept. 2013
Offline
Your Rotation is prolly off because the rotation data stored is taken from the prim and not the object itself.
You can simply extract the orientation from the object and feed it back to the final output using attribute reorient .

Also if you just need to bring your animation to grid and then send it back to the world space,you can simply store the matrix and recall it later.

Look at the attached file.
Image Not Found
Edited by MarXindia - April 18, 2022 16:06:21

Attachments:
calcmatrix_question_Fix.hipnc (371.7 KB)

User Avatar
Member
4544 posts
Joined: Feb. 2012
Online
Hi,

It's not very clear what you are trying to do. The rotation you are seeing is normal because you are using a specific primitive to base the transform on like MarXindia mentioned. The geometry as is doesn't have any transformation.

If you just want to center the geometry using a specific primitive, you can either ignore the rotation in the computed matrix or just use the center of the primitive to move the geometry to the origin. You can also use the center of the geometry itself to do the same.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
  • Quick Links