RBD Number of Collisions per Object

   4673   3   4
User Avatar
Member
4 posts
Joined: March 2012
Offline
I'm trying to add color to an object based on collisions, but I don't know where to start.

I want to start with a small example, so I've created a Ground Plane, sphere, and made the sphere a RBD Object. The sphere falls and bounces about three times onto the plane.

Right now, I'm trying to get the number of collisions and feed that into a rand() in a Primitive node's Add Color attribute. I've found this expression on the internet:

dopnumrecords($DOPNET,$OBJID,“Impact”,“Impact”)

But I'm not sure how to use it. It looks like it's being used in the DOP network, but I think I'll have to do it in my geo's network so that I can add the color. This is the only way I've found to access the collision count, but I need some help with how I'm supposed to get that to the object's color.

Eventually I want to possibly have the color stick to the closest points on the collision, but I'm trying to start small. Also, there would be lots of objects, so I'd need to feed in an objects ID along with the collision count to get a unique number.

Any help would be appreciated, even if you just want to guide me along finding this out myself. I haven't opened Houdini in a while, but I thought this would be a good way to get familiar again.
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
You can start off with the RBD Impacts tool from the shelf that uses the Impact Analysis Solver DOP alongside the RBD Sovler DOP in to a multi-solver. This gives you the average impact time, position and value for each RBD object that has a collision.

Along with the Impact Analysis Solver DOP, the RBD Impacts shelf tool also creates a new object that extracts the impact point data out of the simulation. Have a look at the details view (geometry spreadsheet) on that DOP Import SOP and you will see the average impact data on each RBD piece.


It is also straightforward to manage the impact data yourself.
The SOP Solver DOP in H12 now has four pre-defined SOPs for you, each designed to extract various pieces of commonly accessed data from the simulation:
- Geometry data
- Impact data (the one you want to look at)
- Impact Feedback data (should also look at this and records impact feedback data)
- Relationship Geometry which allows you to work on the glue constraint geometry created by the Glue Adjacent tool

The SOP Solver is the preferred tool to manage the impact data and it is already set up for you. Just insert a Multi-Solver DOP in place of the original RBD Solver DOP and then wire the RBD Solver and the Sop Solver DOP in o the right input of the Multi-Solver.

How you would use this data depends on what you want to do. You can inspect the actual point data and have a look at the Details View (geometry spreadsheet) to do some data mining (see whatcha got and do whatever with it).
There's at least one school like the old school!
User Avatar
Member
4 posts
Joined: March 2012
Offline
WOW!

Thank you so much, that was some of the best help I've ever received.

I'm looking at this spreadsheet and it really is a lot of data (I might be able to do better things than I thought I would)!

I'm a python programmer trying to understand some concept in Houdini, and I have another question.

I want each object in a simulation to carry some additional data, such as how many times an object has collided, or which objects it's collided with. This spreadsheet lists impacts by time, but not in an easy way so that I can query for each object the collision times.

The obvious answer to me is to have a script that executes each frame that would look at the new data for that frame, and then append the information gathered to a variable on each object. That way, I can reference something like /obj/object10 and get the variable collisionCount and use that somewhere else.

I get the feeling that I have to approach this differently in Houdini, and someone else might have a better answer. How might I gather data from this impact spreadsheet to compute new data that I can then use easily in something else, like a shader?

I guess the easier question to answer is this: Can I feed this data from the node into a Python script sort of node and use that to change attributes on other nodes? And would this script have the same locals, so I can store things across frames?
User Avatar
Member
28 posts
Joined: Jan. 2010
Offline
There is an EXTREME lack of examples on the syntax for sopsolver - Im trying to loop through primitives ( the glue network) and change the constraint from spring to glue based on the constraints ‘force’ - but after spending most of this afternoon trying various ideas out I still cannot find how to do this
  • Quick Links