sessionbeer Posted July 1, 2015 Share Posted July 1, 2015 Hello, I am stuck with how to correctly apply rotations to an object around its Normal. I have made a quick scene to try and show this. I know it is possible in the CopySop but I really need to do it in a Vop, but unfortunately my rotation matrix math is pretty bad. In the image below, if the xform node is bypassed, the rotations of the cubes is correct, but once I turn on the xform, the axis of rotation is off. Would appreciate any help on this as it is something I have been fighting with for a while now and I've exhausted google. Cheers maketransfrom_individually_03.hipnc Quote Link to comment Share on other sites More sharing options...
mestela Posted July 2, 2015 Share Posted July 2, 2015 (edited) I'm sure there's a cleaner way, but this works. You've saved the pivot for each cube as 'middle', which is copied to every point. I added normals to the grid driving the copy, and copy that to every point as 'Norig'. I then -subtract 'middle' from each point, which has the effect of moving every cube to the origin -use a rotate vop with Norig as the axis, and rotate the cubes (I could only make the rotate vop work around the origin, hence the prior step) -add 'middle' to each point, restoring the cube positions Fairly sure there's a way to do the rotation in one step without the pre/post transform, but like you, my matrix maths failed me. rotate_Norig.hipnc Edited July 3, 2015 by mestela Quote Link to comment Share on other sites More sharing options...
Alex Lombardi Posted July 4, 2015 Share Posted July 4, 2015 (edited) you can create your own transform with some vex aswell (only a few lines). v@N will be our "y" and you can use v@up for your "x" or "z" vector. The copy node will use the two vectors(N and up) to copy geo with the correct transforms. in vex you can just use the rotate expression with our new matrix based on N and up. then you just redefine the v@N and up before the copy node. this way you can have control over each copy geos rotation via @ptnum. hope that's useful ALSO NOTE: if you use houdini 13, be sure to cast the v@up to a [x,y,z] vector instead of a float vector, that way tthe transform node will update it properly. rotate_NandUp.hipnc Edited July 4, 2015 by Alex Lombardi Quote Link to comment Share on other sites More sharing options...
sessionbeer Posted July 6, 2015 Author Share Posted July 6, 2015 Thanks Alex and Mestela for you're replies, both very useful to study! 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.