Jump to content

controling crowd starting positions


meldrew

Recommended Posts

Hi all,

 

I've been using the crowd shelf tools this week, trying to get to know them.

The example files are super helpful, and have taught me a lot, but I'm getting slightly stuck on one seemingly simple thing. Controlling the initial position of the agents.

 

For example, I have around 10 agents, walking, following a circular path. However I cannot figure out how to define the starting positions of the agents to be along that circle (so that they are all walking around it from F1). I can only seem to be able to randomly populate a surface, or set the population to 'formation', which allows me to do a straight line, but not a curved one.

Both of these are v useful, but is there a way to set a custom starting state for agents (i.e placed along a curve)?

Basically I want to set up agents walking around a circular pool.

 

Any tips much appreciated. :)

Thanks.

Link to comment
Share on other sites

You can do pre-processing in the CrowdSource node. Right before the OUT add an AttributeWrangle and simply set the position by assigning an XYZ value to @P.

Assign agent #0 to world origin.

if (@ptnum == 0) {
    v@P = set(0,0,0);
}
	

Untitled-1.jpg

Edited by Atom
Link to comment
Share on other sites

14 hours ago, Atom said:

You can do pre-processing in the CrowdSource node. Right before the OUT add an AttributeWrangle and simply set the position by assigning an XYZ value to @P.

Assign agent #0 to world origin.


if (@ptnum == 0) {
    v@P = set(0,0,0);
}
	

Untitled-1.jpg

Hi Atom,

 

Thanks for the tip, and it definitely does what it says on the tin! :)

However, how would you suggest approaching a setup where I may need to bump up the number of agents? Or, if the agents needed to move with military precision (i.e no variance or deviation from the curve at all)?

I guess in a perfect world, we'd be able to set the initial positions of the agents based on actual scatter/copy functions directly onto geo point-counts (for those of us who aren't so hot with VEX yet). Copying onto a spline and saying 'march along it' would be super useful feature imho.

 

I've attached a scene here of how far I've gotten with the circular path - Would it be possible for you to cast an expert eye over it to see if there are any glaring mistakes I may have made, and possibly point me in the right direction (again)? I'd really appreciate it. 

If you're too busy, then no worries.

Thanks again. :)

formation_circle_test.hip

Link to comment
Share on other sites

Or, here I am trying a far simpler setup, based on the 'stadium' example file, where the agents are copied directly onto points from the embedded .bgeo.

Again, I don't really understand why I cannot apply agents directly to points in my scene in the same way. I assume perhaps it's based on the density attrib?

 

Once more, any help or guidance much appreciated. :) 

formation_circle_test_002.hip

 

 

EDIT:

Update: After bugging with it for ages, finally just decided to re-install to latest stable version & it works just like in the example file now! :)

This crowd utility is pretty cool.... Going to keep exploring it for a few days - see if I get anything interesting.

Edited by meldrew
found solution, so decided to share
Link to comment
Share on other sites

Here is a simple example of driving the agent location from external SOP points that travel down lines. The points follow paths which conform to the terrain but the paths could be any shape you like. Just like before there is a pre-processing wrangle in CrowdSource that sets the initial agent location to the start of each path. Inside CrowdSim there is a PopWrangle which fetches the current location along the path and updates the agents position. The stride and speed are not really right so you will have to tweak that for your agents. There are a couple of wrangles in the path point generation that allow you to control the speed the point travels along the path. Tweak that and Gait Speed to reduce agent skating.

 

ap_crowd_follows_path_1a.hiplc

Untitled-1.jpg

Edited by Atom
  • Like 2
Link to comment
Share on other sites

1 minute ago, Atom said:

Here is a simple example of driving the agent location from external SOP points that travel down lines. The points follow paths which conform to the terrain but they paths could be any shape you like. Just like before there is a pre-processing wrangle in CrowdSource that sets the initial agent location to the start of each path. Inside CrowdSim there is a PopWrangle which fetches the current location along the path and updates the agents position. The stride and speed are not really right so you will have to tweak that for your agents. There are a couple of wrangles in the path point generation that allow you to control the speed the point travels along the path. Tweak that and Gait Speed to reduce agent skating.

Untitled-1.jpg

ap_crowd_follows_path_1a.hiplc

Awesome, thanks for the proper explanation. Really appreciate your time! :)

  • Like 1
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...