Jump to content

How to rotate faces along Normal ? in Houdini,


markmu

Recommended Posts

To scale and rotate certain primitives take the group into a primitive wrangle:

  • primpoints() and foreach() will process all points that are connected to the selected polygons
  • instance() allows rotating and scaling around individual pivots.
  • rotate() and quaternion() set up the orient attribute to be used in the instance() function.
float amount = chf('amount') * M_PI;
vector center = v@P;
vector axis = prim_normal( 0, @primnum, vector(0.0) );
vector N = vector(0.0);
vector rot_post = vector(0.0);
vector scale = vector( chf('scale') );

matrix3 m_rot = ident();
rotate(m_rot, amount, axis);
vector4 orient = quaternion(m_rot);
matrix m = instance(center, N, scale, rot_post, orient, center);

int prim_pts[] = primpoints(0, @primnum);
foreach(int pt; prim_pts){
    vector pos = point(0, 'P', pt);   
    pos = pos * m;
    setpointattrib(0, 'P', pt, pos, 'set');
}

 

prim_rot_scale.hip

  • Like 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...