Jump to content

POP Steer Seek teleportation/snapping issue...


Recommended Posts

Hi, 

In Crowd simulation, I am using POP Steer Seek to move agents toward a single point on the terrain. Initially, all agents move toward the target however when they get close to the target they started pushing each other and eventually then snap or jump instantly to different locations around the target.

To fix the problem:

-In Steer Seek behavior, I've checked "Arrival" in the Steer force, increased braking distance and scale

-Created POP Steer Avoid to help agents avoid collision with each other

-Create POP Steer Separate

However, all that did not work and am still getting this snapping/teleportation behavior! Any help will be appreciated :)

 

Link to comment
Share on other sites

Don't do that. Think about it, how could 10-100 people stand in the same exact location?

This kind of problem affects every simulation software I have ever used. The typical work around is to make them go idle when they are near the goal, before they actually reach it and their matrix is inverted. Another way is to simply put a big sphere or box around that goal point so they can never actually get there. Another way is to keep the goal always in motion so they can never reach it.

There is a turn rate (might not be the exact term) in the Crowdsource node that controls how fast an agent can actually spin around or change direction. Try making it very low.

Braking is a good start, though, don't be afraid to really crank it up and increase the distance as well.

Edited by Atom
  • Like 1
Link to comment
Share on other sites

Thanks :) I like your analogy, and I am surprised that it's a common problem, but it's what it is :) To fix the problem I used multiple Points spreaded around the target and that did produce a "good" result. The main thing I still need to improve is agents overshooting, I wish they would slow down as they approach their target and come to a complete stop when they reach their targets. I used brake forces, arrival distance, ... somehow it's acceptable, but not perfect. Maybe I need to make it two states: "seek" then ideal. Anyways, I think I am on the right track, just more tests to do... Once more, thanks for your help.

Link to comment
Share on other sites

The multiple points is a nice approach, but what I do is assign an attribute to each agent called goal or logo_location inside of the CrowdSource node, using an attribute wrangle. Then each agent has it's individual goal that it is trying to reach, typically a scatter centered around the original goal. Scatter points should equal agent count that way there is a 1:1 ratio for agent to goal. I also keep an additional float attribute which is distance to the goal. You can update this distance inside a PopWrangle every frame. Then inside a transition node, set to VEX mode, you can simply inspect the distance and set i@trigger to transition to a new state when the goal is near.

Here are some code snippets from a scene where I had agents walk to form the shape of a logo.

Put the PopSteerSeek into VEX mode and use this code.

// This agent is attracted to a point scattered within the target area.
goal = set(v@logo_point_location[0], v@logo_point_location[1], v@logo_point_location[2]);// This code ASSUMES that there are the same number of scatter points as agents.

Here is what I place in the attribute wrangle of the CrowdSource node to initialize each agent.

f@logo_point_distance = -1.0;             
v@logo_point_location = {0.0,0.0,0.0};

 

Here is what I place in the PopWrangle to update distance. (assumes a scatter node exists at obj level)

// 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(), "logo_point_distance", i, scatter_distance, "set");               // Assign this location to an attribute on myself.
    setpointattrib(geoself(), "logo_point_location", i, final_location, "set");                 // Assign this distance to an attribute on myself.
}

 

Here is what I place in the Transition node.

// Transition to stand when I close to scatter point location.
if (f@logo_point_distance < 1) {i@trigger = 1;} else {i@trigger = 0;}

 

 

Edited by Atom
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Hi, just a quick reply :) I still need to read/study your email, but I just wanted to share what I did: basically, I have a scaled-down version of what you have described, just implemented the 1-1 mapping between targets and agents using Houdini directly, I think in your solution you have code to do that? The crowd "seek to" behavior has "points" option, which takes two attributes to do the one-one seeking (plz, see attached). Initial tests are good. Maybe I will need to add a second state to slow down the agents, but so far I think it's okay (what makes work is that the number of targets are the same number of agents, as you said in your email...)

Alright, thanks again :)

agents_to_points.png

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...