Crowds - Pop Steer Path, a different path per agent

   103   0   1
User Avatar
Member
11 posts
Joined: April 2019
Offline
Hello,
Is it possible specify that an agent can only walk on a specific path? In my example, I generated a bunch of polylines I want to use as paths. The first point of each path was used for the crowd source. The paths were then all merged and fed as an input into the Pop Steer Path. This of course creates a problem that if paths are intersecting or going in a similar direction, even though the agents all started on their own path, they will veer off onto another (which is not what I am after).

I kind of got a similar thing to work here, where I created an attribute path_pos so I can query how far along a path an agent is. But I am not sure how to 'split' out a prim inside the Pop Steer Path vexpression like I do here in a pop wrangle.

I also tried using the Curve Point Method on the Pop Steer Path instead, but I seem to end up with even more wandering agents, most likely due to the spaghetti mess of paths shown here.

if (i@path_bound == 0)
{
    // Find the nearest path at the *spawn* position (frame-locked input 2)
    int    p;
    vector uv;
    vector spawnP = point(2, "P", @ptnum);

    xyzdist(1, spawnP, p, uv);   // search all paths once
    i@path_prim = p;             // remember which path matches this agent
    i@path_bound = 1;
}

// Now compute closest uv on corresponding prim only, at current position
int p_now;
vector uv_now;
float  d = xyzdist(1, sprintf(%d, @path_prim), @P, p_now, uv_now);  // the prim input must be a string according to documentation

float u = clamp(uv_now.x, 0.0, 1.0);
f@pathpos = u;

Edited by juri0juli - Sept. 1, 2025 09:41:06

Attachments:
crowdpaths.png (1.2 MB)

  • Quick Links