Whatsinaname Posted July 13, 2015 Share Posted July 13, 2015 (edited) In my scene, there are lots of similar objects, consisting of points. The points have an attribute, indicating to which object they belong (object_ID). If any of those points collides with another object in the scene, the pscale of those points should be set to 0. The collision test etc works just fine, I only don't get how to set the object_ID, like: A) get the object_ID for the points inside the collision volume (works) B ) get all other objects with the same objectID and set their pscale to 0.0 (doesn't work) Here's what I'm doing: float sdfCheck = volumesamplefromfile(1,"surface"@P); if(sdfCheck < 0) { // change color to visually identify points inside collision volume @Cd = {1,0,0}; //open a pointcloud and check for the object_ID value int handle = pcopen(0,"P",@P, 20000, 100); int ref_object_id; float target_pscale = 0.0; while(pciterate(handle)) { pcimport(handle,"object_id", ref_object_id); //check if the object_id at the pointcloud point is the same as the object_id of the point inside the collision volume if(i@object_id == ref_object_id) { // doesn't work as channel is not writable...?? pcexport(handle, "pscale", tgt); } } } pcexport doesn't seem to be the right idea in that context, but what should I be doing instead? Thanks in advance for any ideas! Edited July 13, 2015 by Phlok Quote Link to comment Share on other sites More sharing options...
anim Posted July 13, 2015 Share Posted July 13, 2015 you can use setpointattrib() if the attrib already exists. if not then as well addattrib() to initialize it first; Quote Link to comment Share on other sites More sharing options...
anim Posted July 13, 2015 Share Posted July 13, 2015 you can as well use findattribvalcount()/findattribval() combo to loop through all points with certain attrib value and set their pscale instead of checking all points for matching object_id yourself 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.