I opened an old Houdini file with a crowd simulation. It used to work fine, but now I get an error message inside my PopWrangle. Houdini no longer lets me set values using VEX on an agent?
Here's the code that generates the error.
stringhandle_path = "op:/obj/crowd_sim:crowdobject/Geometry"; // Path to our database of attributes.vectorgoal_location = point(handle_path,"P",i@relay_id); // Fetch the point location of the goal.floatrelay_distance = length(goal_location - @P); // Get distance between my location and the relay location.setpointattrib(geoself(), "relay_point_distance", i@id, relay_distance, "set"); // Assign this location to an attribute on myself.
The problem seems to be referencing @P inside a wrangle. How else am I suppose to calculate the distance between a goal and the current Agent being evaluated? If I substitute @P with a local constant vector, the error goes away.
I have tried altering the PopWrangle Inputs to reference Myself, but that didn't help.
Edited by Enivob - 2023年1月29日 09:19:47
Using Houdini Indie 20.0 Windows 11 64GB Ryzen 16 core. nVidia 3050RTX 8BG RAM.
vectorgoal_location = {0,0,0};
floatrelay_distance = length(goal_location-@P);
setpointattrib(geoself(),'relay_point_distance', @ptnum, relay_distance, 'set');
// having i@id in place of @ptnum will cause a failure when storing relay_distance in my simplified case
Edited by SWest - 2023年1月29日 11:48:36
Interested in character concepts, modeling, rigging, and animation. Related tool dev with Py and VEX.
In this case, if you're not actually needing to write to P you can remove it from the "Attributes to Create" list
If you did actually need to write to it, changing the POP wrangle inputs to "Myself" instead of "Myself (no reads of outputs)" would normally be the solution here, since you can't safely read from an attribute on other points in the geometry that is also being written to when multithreading is involved. But that doesn't work here because you're using a string path that happens to be the same as the geometry being modified ("op:/obj/crowd_sim:crowdobject/Geometry") rather than the 0/1/2/3 or @OpInput0 etc inputs