Jump to content
markmu

How to rotate faces along Normal ? in Houdini,

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×