pau22 Posted April 13, 2016 Share Posted April 13, 2016 Hello! After transferring a color attribute to some points I would like to apply them a force, as long as they have the blue color transferred. I've tried the following code in the pop force node without success: vector color= point(0,"Cd",@id); if(color.z !=0 ) force*=@id; What am I doing wrong? Thanks Quote Link to comment Share on other sites More sharing options...
Atom Posted April 13, 2016 Share Posted April 13, 2016 (edited) Force is a float attribute, right? Try: f@force *= i@id; Use the shortcut letters in front of the @ symbol to insure the correct type casting. That particular code example does not make sense, however. You would be multiplying the force by the index of the point. So the first point won't move at all, the second will will move slow and the third one twice as fast as the second one etc... Perhaps something like this for random force applied to each point within a given range. f@force *= fit01(random(i@id), 0.4, 1.2); Edited April 13, 2016 by Atom Quote Link to comment Share on other sites More sharing options...
pau22 Posted April 14, 2016 Author Share Posted April 14, 2016 (edited) Hello, I've tried the some more expressions but the points with transferred attributes still move with the other points, so multiplying the force by the index is not a good option indeed. Could it be a good choice to use a point cloud expression ? I have attached a test file so you can see what i'm trying to do Thanks point_color_force_v1.hip Edited April 14, 2016 by pau22 Quote Link to comment Share on other sites More sharing options...
Ryan Posted April 14, 2016 Share Posted April 14, 2016 The point function needs to be in a POP Wrangle to grab the color attribute from SOPs. Also you shouldn't use f@force. "force" is a reserved Houdini variable in DOPs and its a vector. Call it something else. I have attached an edited file. point_color_force_v2.hip 2 Quote Link to comment Share on other sites More sharing options...
pau22 Posted April 14, 2016 Author Share Posted April 14, 2016 Thank you Ryan! It's exactly what I wanted to achieve.That helped me understand a little more how the particles and attributes work in Houdini! Quote Link to comment Share on other sites More sharing options...
Atom Posted April 14, 2016 Share Posted April 14, 2016 (edited) I guess Ryan beat me to the solution. In my setup the points actually start moving based upon the VEX code even if the force is zero. Our setups are very similar, however. if(v@Cd.b !=0 ){ force[1] += 0.1; } ap_point_color_force_v1.hipnc Edited April 14, 2016 by Atom 2 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.