Search - User list
Full Version: Vexpressions in DOPs (Crowds)
Root » Technical Discussion » Vexpressions in DOPs (Crowds)
juri0juli
Hello,
I am having trouble getting vexpressions to work inside of DOP nodes.

My goal with this setup is to have an agent go towards object A using a pop steer seek, and once it reaches some threshold, then go to object B. If I just key the weight parameter between the two seek nodes, then things work as expected, but I need to make this more automated.

Since turning the weight parameter to 0 seemed to make the agent 'lose interest', I had the idea of using the Vexpression parameter to query how far away my agent is from the object, and if below some threshold set the weight to 0. However, I can't seem to figure out how to do this.

Using a pop wrangle node, I can change the color of my agent for example once it reaches the target, but I can't seem to use this code inside of the vexpression. I tried something simple like just setting the steer weight to 0, but with no luck. So I think I can't figure out how to properly connect to parameters and attributes using vexpressions.

My original pop wrangle node code:

// dynamic agent position
vector agent_pos = @P;

// bed pos
vector bed_pos = point(1, "P", 0);


// distance threshold
float max_dist = 2.5;

//distance of agent from bed
float dist = distance(agent_pos, bed_pos);

// if dist is close enough, color
if(dist < max_dist){
@Cd = {1,0,0}; //eventually this would be replaced with turn off 'interest/weight' in steerforce
}



If anyone has suggestions or can point me in the right direction, would be much appreciated.
Enivob
Try setting the goal in one tab.
goal = point(1, "P", @ptnum);

And the weight in another.
weight = 1.0; //fit01(rand(@ptnum), 0.5,1.5);

When driving a panel value inside a VEXpression, you don't reference them using the @ symbol. Try hovering over the field and read the tool tip. The variable you need to reference will be displayed in the tip.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB