Jump to content

Multiple paths with POP Steer Path


kumpa

Recommended Posts

How does one deal with multiple paths in POP Steer Path I would like to be able to assign a list of possible paths to each agent particle instead of all the particles following all the paths. Currently I set up multiple sops and multiple agent groups but that's not very scalable.

Cheers

Link to comment
Share on other sites

You could carve a single point down each path. Then use each path's carve end point as a goal point per-agent.

Use VEX: on pop steer node (I'd probably use a pop seek)

Untitled-1.thumb.jpg.f0c823a5658a3a20167b075db631b9d0.jpg

goal = v@goal_P;

After you have merged all your states, drop down a PopWrangle and use code to transfer the carved point's location to the v@goal_P. This code updates the distance to the goal on every frame. (i.e. path endpoint or carved point in motion).

// Update each agent's distance to the target point.
string agent_path = "op:/obj/geo_agent_setup/dopnet_crowdsim:crowdobject1/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_agent_paths/OUT_CARVE_POINTS";                               // Path to our animated carve points. (a single point per path)
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. (path point count assumed to be equal to agent count).
    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 carve.
    float scatter_distance = length(scatter_location - agent_location);                         // Get distance from carve 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_distance", i, scatter_distance, "set");                     // Assign this distance to an attribute on myself. 
    setpointattrib(geoself(), "goal_P", i, final_location, "set");                       	// Assign this location to an attribute on myself.
}

 

Edited by Atom
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...