Jump to content
Sign in to follow this  

Multiple paths with POP Steer Path

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.


Share this post

Link to post
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)


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

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this