Jump to content

Bullet, number of connected pieces


gpapaioa

Recommended Posts

Hello everyone.

 

I am doing a bullet sim with cone twist contstrains and my goal is to trigger some event when one piece is not connected to any other piece. I would like to save the number of connected pieces (of each piece) in one attribute so I can know when exactly this attribute turned to 0. 

 

Is this some value I can extract from DOP (number of connected primitives) or smth possible by using VEX and nearpoints() like functions after sim?

 

Thank you.

Link to comment
Share on other sites

If you have a constraint system there should be a SOP Solver attached. Dive inside the sop solver and you will have access to the constraints as reference geometry You can place a wrangle inside that context to count them as you see fit. That is how I have done glue bonds breaking from an external proximity object such as particles.

 

Do you have a simple example to test on?

Link to comment
Share on other sites

You should be able to so long as you have not removed the primitive by the time you get to run your analysis code.

 

One of the fundamental flaws I have found in the Houdini API is that you can't set attributes information outside of the context you are in. This is because you can only pass geoself() to a setattrib.

 

However, you can pass any arbitrary path to read point attributes from. So maybe you can think backwards. Store the information locally on the reference geometry and then fetch from outside of DOP to make your decision.

// I can construct a path into a simulation
string agent_path = "op:/obj/crowd_sim:crowdobject/Geometry"; 
vector agent_location = point(agent_path,"P",@id);
// From within DOPs I can also reach out to another SOP network.    
string scatter_path = "op:/obj/geo_target/scatter1";                                  
int scatter_count = npoints(scatter_path);
 
// But I can only write to the context I am in.
setpointattrib(geoself(), "P", @ptnum, some_location, "set");
Edited by Atom
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...