Crowd Trigger based on end of the clip time

   2820   4   0
User Avatar
Member
3 posts
Joined: Nov. 2017
Offline
Hi,
How can I trigger the agents to transition as their current state duration ends?

Attachments:
agents.rar (4.1 MB)
crowd_trigger_based_on_endofclip.hipnc (517.8 KB)

User Avatar
Member
2563 posts
Joined: June 2008
Offline
Try setting one_trig_to_walk to Current State Duration with a time of 2.

Attachments:
stand_walk.gif (841.7 KB)

Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
3 posts
Joined: Nov. 2017
Offline
Thank you Enivob for the reply!
Yes but actually the hip file I sent is a very simple version of what I'm doing.
In the actual project “one_standingUp” state for example consists of many different clips with different durations
and time of 2 does not work for all of them. I'm looking for a sort of a procedural way to trigger them to Walk as their stnadingUP clip ends.
Edited by alinikk - June 8, 2018 12:31:43
User Avatar
Member
2563 posts
Joined: June 2008
Offline
Another type available on the Crowd State node is the Custom VEXpression.
There are several useful functions for interrogating agents to discover where they are at in their animation cycle.
Use agentcliplength to get how long the cycle is and then review the f@cliptimes attribute to see where the agent is at within the current clip length.

The take away is that inside your VEX code after making a decision you set the built-in attribute i@trigger to 1 or 0.

Here is some example code I used to determine when to transition when my agent is close to a goal point.
// Transition to stand when agent is close to goal point location.
if (f@goal_point_distance < 1) {i@trigger = 1;} else {i@trigger = 0;}

Inside a PopWrangle I was essentially running a game style update loop with code that scanned where my agent location was and where the goal (i.e. scatter points) was. I create a new attribute upon the agents which represent the distance to the goal point. This code updates that distance every time the frame changes.
// Update each agent's distance to the target point.
string agent_path = "op:/obj/crowd_sim:crowdobject/Geometry";                                   // Path to our agent database of attributes.
int agent_count = npoints(agent_path);                                                          // Number of agents in the system.
string scatter_path = "op:/obj/geo_target/scatter1";                                            // Path to our scatter database of attributes.
int scatter_count = npoints(scatter_path);                                                      // Number of points in the scatter.
for (int i = 0; i < agent_count; i++) {                                                         // Begin looping through all agents. (scatter point count assumed to be equal).
    vector agent_location = point(agent_path,"P",i);                                            // Fetch the point location of the agent.
    vector scatter_location = point(scatter_path,"P",i);                                        // Fetch the point location in the scatter.
    float scatter_distance = length(scatter_location - agent_location);                         // Get distance of scatter point to my location.
    vector final_location = set(scatter_location[0],agent_location[1],scatter_location[2]);     // The final location uses only the XZ of the scatter and the Y of the agent.
    setpointattrib(geoself(), "goal_point_distance", i, scatter_distance, "set");               // Assign this location to an attribute on myself. 
    setpointattrib(geoself(), "goal_point_location", i, final_location, "set");                 // Assign this distance to an attribute on myself.
}

You can review the functions available here.
http://www.sidefx.com/docs/houdini/vex/functions/agentcliplength.html [www.sidefx.com]

Feel free to check out my Crowd Based Relay Race tutorial for a more detailed explanation of creating an update and poll style decision maker for transitions.
https://vimeo.com/208376087 [vimeo.com]
Edited by Enivob - June 8, 2018 13:18:44
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
3 posts
Joined: Nov. 2017
Offline
Thank you so much for the reply Atom!!
You mentioned so many useful points here! I think agentcliplength is what I was looking for.
  • Quick Links