Search - User list
Full Version: Crowds - Reading Single Joint Info inside DOPs
Root » Technical Discussion » Crowds - Reading Single Joint Info inside DOPs
juri0juli
Hello,

I am wondering if it is at all possible to read single joint/point data inside of a Crowd DOP Network?
The situation I am trying to create is:

1. An agent sitting down on a chair, but when their knee joint animation reaches some arbitrary degree, I want to trigger a crowd transition to ragdoll.
2. An agent that was in a ragdoll state after a fall, I want to trigger a 'get up' state once the agent has settled from the fall by querying the velocity of the hip joint.

Since my agent is packed, I can only reach velocity data for the packed data, but not individual joints when looking at my geo spreadsheet crowd object inside of DOPs.

Here is a visual example of triggering a red color when my knee joint bends more than 90 degrees. This example was done in SOPs on a simple animation cycle. Basically I would like to know if it's possible to do this in DOPs if anyone has any ideas! Thank you.
cwhite
You could use VEX functions like https://www.sidefx.com/docs/houdini/vex/functions/agentlocaltransform.html [www.sidefx.com] to query the transforms of specific joints
juri0juli
Thank you @cwhite! I tried something along those lines, but I made a SOP Network inside of my DOPs to get to the joint in question. I can then read the data from it, but I wonder if this step can be simplified? Not sure how heavy it is to unpack my agent during the sim...

In my Crowd Trigger, I use the following VEX, which seems to work

i@trigger = -1;

vector vel = point(0, "v", 0);
float vel_length = length(vel);

if(vel_length < 0.1){
i@trigger = 1;
}

cwhite
For performance reasons I wouldn't recommend unpacking on each frame of the simulation
If you're only examining the joint velocity / angular velocity for ragdolls, there would already be array point attributes on the agent which provide the velocity of the rigid body associated with each joint (https://www.sidefx.com/docs/houdini/nodes/dop/rbdpackedobject.html#agentattributes)
juri0juli
Thanks for the speedy reply. I think I am out of my depth here. I am using a standard crowd sim setup with ragdolls, (copied from the crowds shelf tool ragdoll example) so a crowd object, and I can't see any array information in my network. Would you be able to give me an example of where and how I could grab this data?
I tried to browse through some of the example setups that you linked, but I am still not certain how to get this information out of my sim.
cwhite
Attached is an example of a custom trigger which reads the velocity attribute from the Bullet solver
juri0juli
Amazing! Thank you so much, this example is perfect.
I also found more information for anyone looking at this in the future here:
[www.tokeru.com]
juri0juli
I have one more follow up. I've discovered the section with different agent related things. I am trying to figure out how to get the world position of a joint. I was looking into the function below (agentworldtransform), but I am not sure where to go from there.

https://www.sidefx.com/docs/houdini/vex/functions/agentworldtransform.html [www.sidefx.com]
cwhite
The result from `agentworldtransform()` is still in the space of the agent packed primitive, so you'd also need to combine it with the packed primitive's transform that you get from e.g. `primintrinsic(0, "packedfulltransform", @primnum)`

You could then use a function like cracktransform() to extract different components
juri0juli
Does this look correct? The values my spine_pos outputs seem to be wrong in the x and z values but kind of correct in y.

  int prim = pointprims(0, ragdoll_prim)[0];

            int jid = agentrigfind(0, prim, "pelvis");

            matrix Mw = agentworldtransform(0, prim, jid);

            matrix M_agent = primintrinsic(0, "packedfulltransform", prim);

            matrix M_jnt_world = M_agent * Mw; 

            spine_pos = cracktransform(0, 0, 0, {0,0,0}, M_jnt_world);
cwhite
The multiplication should be in the opposite order (`Mw * M_agent`), but otherwise that looks reasonable to me
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB