# How to rotate faces along Normal ? in Houdini,

## Recommended Posts

in Houdini, how to rotate face along Normal

thanks!

Edited by markmu
##### Share on other sites

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

## 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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×
×