VEX function pcopen returns 0 for handle?

   3235   3   1
User Avatar
Member
2551 posts
Joined: June 2008
Offline
Hi All,

I was inspecting the VEX code inside the Crowd Trigger HDA. There is a Pop Wrangle inside the HDA to handle triggering via proximity. Inside the VEX code a handle is fetched to a point cloud from input 0 (which is not connected to anything).

int handle = pcopen (0, “P”, @P, ch(“../particleproximitysearchradius”), 1000);


However, if I move up one level and try the same thing in a CrowdTrigger running in VEX mode the code always returns zero.

int handle = pcopen (0, “P”, @P, agent_search_radius, 1000);

I assume this is some kind of context error with input 0.(which Crowd Triggers does not have). The help claims you can override this with a direct path to a SOP.
The file name may use the op: syntax to reference SOP geometry in the OP contexts.
What would that path be for a default crowd simulation?
Can I actually gain access to the point cloud that is the agents?

I tried the following but it does not work.

int handle = pcopen (“opobj/crowd_sim”, “P”, @P, agent_search_radius, 1000);
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
242 posts
Joined: Jan. 2008
Offline
Enivob
Hi All,

I was inspecting the VEX code inside the Crowd Trigger HDA. There is a Pop Wrangle inside the HDA to handle triggering via proximity. Inside the VEX code a handle is fetched to a point cloud from input 0 (which is not connected to anything).

int handle = pcopen (0, “P”, @P, ch(“../particleproximitysearchradius”), 1000);


However, if I move up one level and try the same thing in a CrowdTrigger running in VEX mode the code always returns zero.

int handle = pcopen (0, “P”, @P, agent_search_radius, 1000);

I assume this is some kind of context error with input 0.(which Crowd Triggers does not have). The help claims you can override this with a direct path to a SOP.
The file name may use the op: syntax to reference SOP geometry in the OP contexts.
What would that path be for a default crowd simulation?
Can I actually gain access to the point cloud that is the agents?

I tried the following but it does not work.

int handle = pcopen (“opobj/crowd_sim”, “P”, @P, agent_search_radius, 1000);

In SOPs you reference a node and you will get the geometry from that node in return.(“opobj/crowd_sim/sopNode”)

In DOPs you will have to reference a object and what data from that object to fetch. In all solvers were you are simulating geometry the simulation data is called… Geometry.

So to fetch the pointcloud from a crowdsim using op: syntax you will have to use. int handle = pcopen (“opobj/crowd_sim:crowdobject/Geometry”, “P”, @P, agent_search_radius, 1000);

However, if you look on the popwrangle node under the Inputs tab, you will se dropdown menus to pick your input source.
For example if you set input 1 to myself, the code would beint handle = pcopen (0, “P”, @P, agent_search_radius, 1000);

In the trigger node,vex mode, the bindings menu isn´t promoted and that a good RFE.
User Avatar
Member
2551 posts
Joined: June 2008
Offline
Thank you for the explanation. That does allow me to obtain a valid handle that I can use with pcnumfound(handle) to obtain a particle count.

Another weird oddity has come up as I try to migrate my working code out of the Proximity Pop Wrangle of the Crowd Trigger node and up one level to the Crowd Trigger VEX code level.

While this works inside the Proximity Pop Wrangle…

float current_enemy_health = pointattrib(geoself(),“sf_health”, pcId, success);


It no longer works one level up? I have even tried passing a zero, which I have seen done before.
float current_enemy_health = pointattrib(0,“sf_health”, pcId, success);

Basically I am writing a combat system for the Crowd Simulator and agents need to be able to query and modify each other's attributes. These are attributes that I have added, such as health, damage, attack, armor etc…,
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
242 posts
Joined: Jan. 2008
Offline
Enivob
Thank you for the explanation. That does allow me to obtain a valid handle that I can use with pcnumfound(handle) to obtain a particle count.

Another weird oddity has come up as I try to migrate my working code out of the Proximity Pop Wrangle of the Crowd Trigger node and up one level to the Crowd Trigger VEX code level.

While this works inside the Proximity Pop Wrangle…

float current_enemy_health = pointattrib(geoself(),“sf_health”, pcId, success);


It no longer works one level up? I have even tried passing a zero, which I have seen done before.
float current_enemy_health = pointattrib(0,“sf_health”, pcId, success);

Basically I am writing a combat system for the Crowd Simulator and agents need to be able to query and modify each other's attributes. These are attributes that I have added, such as health, damage, attack, armor etc…,

The 0 means “fetch geometry from first input”. You need to be carefull with this in DOPs since dynamic networks doesnt wire top->down. In a wrangle DOP, if the input menu for input 1 is set to none, the 0 you got there doesnt do much. I would be like trying to fetch geometry from SOPs input1 in a unconnected node…
  • Quick Links