Jump to content

VEX, PointClouds - Changing attibute data


Whatsinaname

Recommended Posts

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 by Phlok
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...