isah_voodoo Posted October 29, 2019 Share Posted October 29, 2019 I am trying to randomly translate on the y axis using a for loop. I have successfully randomized the color but for some reason I can't move them upwards. int i=0; vector rand=rand(@class*234.234); f@randY=fit01(rand(@id*234.234),2, 12); for(i; i<10; i+=1){ v@Cd=rand; @P.y=@randY; } What am I doing wrong here? translate_forloop.hipnc Quote Link to comment Share on other sites More sharing options...
toadstorm Posted October 29, 2019 Share Posted October 29, 2019 There's a couple of things here you need to fix. First, a Wrangle, unless it's in Detail mode, is inherently a kind of for-each loop that runs in parallel. So if you're just trying to bump each primitive up by a random amount, you don't need a for loop in here; the wrangle itself will generate a new random value per id. Second, the @P attribute of a primitive is only a sort of pseudo-attribute; it's not writeable the way the point attribute @P is. You'll want to edit point positions in a point wrangle instead. If you want to move each box randomly upwards, you have two good options: you can move the template points before the Copy SOP, or you can pack and instance the boxes and then move them in a Point Wrangle, since a packed object effectively works like a point. 1 Quote Link to comment Share on other sites More sharing options...
isah_voodoo Posted October 30, 2019 Author Share Posted October 30, 2019 @toadstormthank you for the tips. I got it working 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.