Atom Posted April 22, 2017 Share Posted April 22, 2017 (edited) Hi All, I have this mountain sphere where I have scattered a few copies of the letter T upon. I want to be able to rotate each instance along the vertical axis of the letter T, so they spin while aligned to the sphere. I am constructing orientation using the polyframe node but I want to control the secondary rotation via VEX. Does anyone know the VEX code for rotating along a single axis while maintaining the original orientation setup by the polyframe? ap_VEX_random_align_to_surface.hipnc Edited April 22, 2017 by Atom Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted April 22, 2017 Share Posted April 22, 2017 p@rot = quaternion(@Time, @N); The order of transformations: http://sidefx.com/docs/houdini/copy/instanceattrs rotate_instances.hipnc Quote Link to comment Share on other sites More sharing options...
Atom Posted April 22, 2017 Author Share Posted April 22, 2017 (edited) Thanks for taking a look at my problem file. That is almost it, however, when I install your code in my scene the rotation occurs on the wrong axis. I wonder if this is due to the scatter after the polyframe? In your scene if I scatter points, instead of using the surface points the solution is lost as well. Do you know how to migrate the rotational influence to the other axis? I tried swapping X and Z but that did not work either. p@rot = quaternion(@Time, @N); float rx, ry, rz; rx = p@rot.x; ry = p@rot.y; rz = p@rot.z; p@rot = set (rz,ry,rx); Edited April 22, 2017 by Atom Quote Link to comment Share on other sites More sharing options...
3dome Posted April 22, 2017 Share Posted April 22, 2017 (edited) why don't you use your up-vector instead of @N? if I got this right, p@rot = quaternion(@Time, v@up); in your attribwrangle_INSTANCE should do the trick and remove those other lines Edited April 22, 2017 by 3dome Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted April 22, 2017 Share Posted April 22, 2017 When I add scatter after polyframe it still works in my file. Make sure to keep the * in point attributes, though. Quote Link to comment Share on other sites More sharing options...
Atom Posted April 22, 2017 Author Share Posted April 22, 2017 (edited) Thanks everyone, the v@up was the key. This works for my scene. float angle = ch("../rot_amount"); float rand = fit01(random(@ptnum),0,angle); p@rot = quaternion(radians(rand), v@up); ap_VEX_random_align_to_surface.hipnc Edited April 22, 2017 by Atom 1 2 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.