Crowds - Reading Single Joint Info inside DOPs

   647   10   2
User Avatar
Member
11 posts
Joined: 4月 2019
オフライン
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.
Edited by juri0juli - 2025年8月26日 09:45:04

Attachments:
capturekneebend.gif (7.0 MB)

User Avatar
スタッフ
792 posts
Joined: 10月 2012
オフライン
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
User Avatar
Member
11 posts
Joined: 4月 2019
オフライン
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;
}

Edited by juri0juli - 2025年8月26日 10:35:05

Attachments:
sopnet.png (74.8 KB)

User Avatar
スタッフ
792 posts
Joined: 10月 2012
オフライン
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)
User Avatar
Member
11 posts
Joined: 4月 2019
オフライン
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.

Attachments:
crowdnet.png (50.2 KB)

User Avatar
スタッフ
792 posts
Joined: 10月 2012
オフライン
Attached is an example of a custom trigger which reads the velocity attribute from the Bullet solver

Attachments:
joint_vel_trigger.hip (1.0 MB)

User Avatar
Member
11 posts
Joined: 4月 2019
オフライン
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]
User Avatar
Member
11 posts
Joined: 4月 2019
オフライン
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]
User Avatar
スタッフ
792 posts
Joined: 10月 2012
オフライン
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
User Avatar
Member
11 posts
Joined: 4月 2019
オフライン
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);
User Avatar
スタッフ
792 posts
Joined: 10月 2012
オフライン
The multiplication should be in the opposite order (`Mw * M_agent`), but otherwise that looks reasonable to me
  • Quick Links