I have a crowd that's standing around in groups. Each agent has a set of states ( stand, weight shift, arm gesture, etc.). I want the agents to randomly change between these states, play the state through once and then switch to another random state but I can't figure out how to do this with the trigger system. A bonus would be if I could weight the chance of picking certain states e.g. 60% weight shift, 40% arm gesture.
Any pointers would be great.
Make crowd switch randomly between states
3015 5 1- lloydwood
- Member
- 105 posts
- Joined: 11月 2007
- Offline
- Enivob
- Member
- 2543 posts
- Joined: 6月 2008
- Offline
Try adding an attribute to each agent, an index which is in the range of 0-number of states.
Put the Trigger into VEX mode and examine the attribute. If they match then set the flag to true. I don't have Houdini in front of me right now but I think the flag is called i@trigger.
You also need to setup a node with VEX code that runs every frame. This is how you can detect if your clip time has reached the end. When you detect you are at the end of a clip just regenerate a new index for that agent and assign it to the attribute that the triggers are monitoring.
Put the Trigger into VEX mode and examine the attribute. If they match then set the flag to true. I don't have Houdini in front of me right now but I think the flag is called i@trigger.
You also need to setup a node with VEX code that runs every frame. This is how you can detect if your clip time has reached the end. When you detect you are at the end of a clip just regenerate a new index for that agent and assign it to the attribute that the triggers are monitoring.
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
- lloydwood
- Member
- 105 posts
- Joined: 11月 2007
- Offline
- lloydwood
- Member
- 105 posts
- Joined: 11月 2007
- Offline
It's working great! Thanks again for the help.
For anybody who's interested this is the VEX I am running in a sop solver to change the clip assignment after the clip has played through once:
float cliplen = 0;
int cur_clip = 0;
if (@crowdtransition == 0){
if ((f@cliptimes + 0.1) > (agentcliplength(geoself(), 0, s@state)-@TimeInc)){
// This bit ensures the same clip isn't picked again
cur_clip = i@stand_clip;
while (@stand_clip == cur_clip){
@stand_clip = int(fit01(rand(@id), 0, 5));
}
}
}
For anybody who's interested this is the VEX I am running in a sop solver to change the clip assignment after the clip has played through once:
float cliplen = 0;
int cur_clip = 0;
if (@crowdtransition == 0){
if ((f@cliptimes + 0.1) > (agentcliplength(geoself(), 0, s@state)-@TimeInc)){
// This bit ensures the same clip isn't picked again
cur_clip = i@stand_clip;
while (@stand_clip == cur_clip){
@stand_clip = int(fit01(rand(@id), 0, 5));
}
}
}
- Lukas Stolarski
- Member
- 35 posts
- Joined: 1月 2016
- Offline
- 4mylgl6
- Member
- 8 posts
- Joined: 4月 2019
- Offline
I know this is really old but I'm trying to accomplish the same thing and the solution here isn't clear to me. Where is this SOP Solver supposed to connect to? And how do you configure the Crowd Transition DOP in a setup like this?
lloydwood - if there's any chance you still remember this, would be great if you could clear this up.
Thanks!
lloydwood - if there's any chance you still remember this, would be great if you could clear this up.
Thanks!
-
- Quick Links