mikenon Posted June 9, 2016 Share Posted June 9, 2016 Ive been banging my head against this for a few hours. I am building a set of S-shaped fence pickets within a for-loop. I would like to orient each picket to be aligned with the tangent of the curve path. The problem is that the picket itself is built within the for-loop so that each picket can be customized. So I need to orient the pickets after they have been built. I will eventually need to make some fairly complicated customizations for each picket instance, so I don't want to get rid of the structure of building the picket within the for-loop. I have gotten as far as storing the tangent of the curve path (tangentu) and the x,z coordinate of each picket's pivot point (pcx,pcz). But I cannot figure how to use that information to rotate each picket around the pivot so that it is aligned with the curve. Or maybe there is a simpler way? HIPNC file attached. exp2.hipnc Quote Link to comment Share on other sites More sharing options...
mikenon Posted June 10, 2016 Author Share Posted June 10, 2016 Well, I solved my own problem. For anyone curious, the key was using the stored pcx, pcz and tangentu attributes. A little attribute point wrangle did the trick: float angleT = -$PI/2 + atan(v@tangentu.x,v@tangentu.z); vector pivot = set(@pcx,@P.y,@pcz); float dist = distance(@P,pivot); float r = atan(@P.x-pivot.x,@P.z-pivot.z); @P.x = pivot.x + dist*sin(r+angleT); @P.z = pivot.z + dist*cos(r+angleT); 1 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.