Atom Posted July 11, 2015 Share Posted July 11, 2015 (edited) Ok, I have 160,000 points being skinned down a curve using a circle. I want to divide the curve into 10 sections. Each of the circles in that section gets it's own random value applied to the radius of the circle through a stamp function. So I have $NPT, $PT and the number 10 to determine my section count. What expression would I type into the Value1 field of the Stamp TAB of the Copy node to produce the above desired effect? if I had multiple lines I could calculate the value I need to supply to the rand() seed to produce the desired effect but I am stumped on how to create this in one line of Hscript code. Here is the pseudo code I would like converted into one line. $NPT = 160000 sections = 10 delta = $NPT/sections result = 0 if $PT > delta: result =1 if $PT > delta*2: result = 2 if $PT > delta*3: result =3 if $PT > delta*4: result = 4 if $PT > delta*5: result =5 if $PT > delta*6: result = 6 if $PT > delta*7: result =7 if $PT > delta*8: result = 8 if $PT > delta*9: result =9 In the end the result would be routed to the random seed so that only 10 different circle sizes appeared along the skinned tube via stamping. Edited July 12, 2015 by Atom Quote Link to comment Share on other sites More sharing options...
Shinjipierre Posted July 12, 2015 Share Posted July 12, 2015 float npts = npoints(0); i@id = floor(@ptnum/npts*10); In a wrangle Quote Link to comment Share on other sites More sharing options...
Atom Posted July 12, 2015 Author Share Posted July 12, 2015 (edited) Thanks for the Wrangle solution but I need to type the final expression into an hScript expression field inside a Copy node. But that is close. I just need to find the hscript equivalent of floor. and int. More pseudo code. int(floor($PT/$NPT*10)) Edited July 12, 2015 by Atom Quote Link to comment Share on other sites More sharing options...
mestela Posted July 12, 2015 Share Posted July 12, 2015 Not really, you should be able to use the wrangle and the 'attribute stamps' field, much cleaner. Look at the scene I just posted for an example of this: http://forums.odforce.net/topic/23231-animation-controlled-by-color/?p=137048 Quote Link to comment Share on other sites More sharing options...
Atom Posted July 12, 2015 Author Share Posted July 12, 2015 (edited) Thank you for the insight. That does indeed work. I placed the AttributeWrangle before the RIGHT input of the Copy. Then I can reference the attribute name in the stamp as you mention along the LEFT input stream. Now my curve has a different radius but only in the ten sections I want. Edited July 12, 2015 by Atom 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.