mstarktv Posted October 5, 2016 Share Posted October 5, 2016 I am kind of stuck on how to use loops alongside of VEX...or even at all. I'm posting my example file, but what I'm trying to achieve is just to have a function repeat - and if possible in different ways. In my file, it's a line and I'm making the scale of the point equal 1, if the ptnum and Frame are equal. My problem is repeating it. I tried using the solver sop, but it did as expected and just compounded the spheres scale to equal 0. I'm not really sure where to go from here Any help is always appreciated! loop.hipnc Quote Link to comment Share on other sites More sharing options...
Sepu Posted October 5, 2016 Share Posted October 5, 2016 (edited) I believe this is what you are looking for ? if(@ptnum == @Frame){ @pscale = @ptnum; } Edited October 5, 2016 by Sepu Quote Link to comment Share on other sites More sharing options...
mstarktv Posted October 5, 2016 Author Share Posted October 5, 2016 Unfortunately, that isn't it. That is scaling it by it's @ptnum. Right now I have: Quote if(@ptnum==@Frame) { @pscale = 1; } else { @pscale = 0; } Which works. Basically, I'm trying to loop the action. I'm not trying to scale it by the point number. More or less I'm using this as a visual aid to help with implementing loops into vex. Quote Link to comment Share on other sites More sharing options...
mestela Posted October 5, 2016 Share Posted October 5, 2016 Modulo (%) is usually the way to loop things. It's similar to when you first learn how to divide, and calculate the remainder, modulo just gives you the remainder. So if you do.... float t = @Frame % 5;' ...t will be 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 So if you need a longer loop, change '5' to some other number, and if you want the loop to be faster or slower, change the @Frame or @Time input, eg: float t = (@Time * ch('speed)) % ch('loop_length'); 1 Quote Link to comment Share on other sites More sharing options...
mstarktv Posted October 5, 2016 Author Share Posted October 5, 2016 Just now, mestela said: Modulo (%) is usually the way to loop things. It's similar to when you first learn how to divide, and calculate the remainder, modulo just gives you the remainder. So if you do.... float t = @Frame % 5;' ...t will be 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 So if you need a longer loop, change '5' to some other number, and if you want the loop to be faster or slower, change the @Frame or @Time input, eg: float t = (@Time * ch('speed)) % ch('loop_length'); Perfect! Coincidentally, I always scour your site before posting here. Also...off topic, looking forward to your Houdini Class thing. Thanks again, Matt! Quote Link to comment Share on other sites More sharing options...
mestela Posted October 5, 2016 Share Posted October 5, 2016 Cool, I thought I had a thing about that somewhere, I'll make it a clearer break-out bit if it isn't. Quote Link to comment Share on other sites More sharing options...
mstarktv Posted October 5, 2016 Author Share Posted October 5, 2016 I'm sure it is, I just didn't know where to find it. I gave the "@Frame % #" a try and it's 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.