6ril Posted February 12, 2016 Share Posted February 12, 2016 (edited) May I please pick your brain? I'd like to create a crowd trigger that would activate when an agent reach its goal. I even read in the doc : At each step in the simulation, Houdini looks at each agent and checks a series of trigger nodes (for example "distance to target > 2"). Unfortunately, I can't found such an option in the trigger type list : / here is what I'd like: my agents are walking to a target. the target is a grid with ordered point numbers. I set it up so that each agent seek the point matching it's agent number (agent0 goes to point0, agent1 to point1 ...) at the moment when an agent reach it's point(target) it's stay there, turning on the spot with the walk animation. So I would like to create a trigger that detect when an agent is on it's corresponding point on the grid, to switch it to the stand state. thanks in advance, I'm sure it's very simple, yet I can't seem to figure it out on my own :/ *edit* I should mention that the trigger type "object distance" isn't doing the trick. As agent would stop as soon as they get near the grid, instead of stopping when near the matching point. **edit** If only I could write simple VEX, I could use an unsafe method -> when velocity =0 then activate trigger. but I can't : // setting i@trigger to 1 will enable// setting i@trigger to 0 will disablei@trigger = @v=0; can someone correct this ? Even tho it's very unsafe (if an agent get stuck for some reason it might change the state, right?) Edited February 12, 2016 by 6ril Quote Link to comment Share on other sites More sharing options...
6ril Posted February 13, 2016 Author Share Posted February 13, 2016 I've posted three questions about the crowd pb I encountered, and this one is the most important. The other two are solved, thanks to this very helpful forum I thought this one was pretty easy for advanced houdini users, but no replies : / Maybe I'm mistaken about the complexity of my pb... (but I don't think so.) I'll be patient Quote Link to comment Share on other sites More sharing options...
6ril Posted February 14, 2016 Author Share Posted February 14, 2016 I'm really struggling on this one : / anyone ? Quote Link to comment Share on other sites More sharing options...
6ril Posted February 14, 2016 Author Share Posted February 14, 2016 ... no one.. well, maybe it's a good thing that no one bothered to answer this, as I figured it out on my own. Quote Link to comment Share on other sites More sharing options...
michael Posted February 16, 2016 Share Posted February 16, 2016 what was your solution? you timing may have been bad as this weekend was Valentines Day, and Monday Feb 15th was a holiday for most of Canada - and for both the Toronto and L.A. offices of SideFX Quote Link to comment Share on other sites More sharing options...
6ril Posted February 16, 2016 Author Share Posted February 16, 2016 Hey Michael, thanks for your post. If my timing was bad, yours is perfect! As I didn't quite solve my problem :/ I used Object Distance (point cloud) as trigger Type. With a small comparison distance. I thought it worked, on the large crowd, but I couldn't really see that in fact, agents are stopping (triggering) not at the right point ID, but as soon as they pass near enough any point... any idea on how to to achieve what I described in the first post? here is what I'd like: my agents are walking to a target. the target is a grid with ordered point numbers. I set it up so that each agent seek the point matching it's agent number (agent0 goes to point0, agent1 to point1 ...) at the moment when an agent reach it's point(target) it's stay there, turning on the spot with the walk animation. So I would like to create a trigger that detect when an agent is on it's corresponding point on the grid, to switch it to the stand state. Quote Link to comment Share on other sites More sharing options...
cwhite Posted February 16, 2016 Share Posted February 16, 2016 You should be able to use a custom VEXpression trigger with a condition something like length(@P - point("/path/to/sop", "P", target_ptnum)) < tolerance 1 Quote Link to comment Share on other sites More sharing options...
6ril Posted February 16, 2016 Author Share Posted February 16, 2016 ok Cameron, I'm going to try to use your VEXpression. will post back to let you know. Quote Link to comment Share on other sites More sharing options...
6ril Posted February 16, 2016 Author Share Posted February 16, 2016 (edited) well... that was quick ! I can't. I'm too new to all this to be able to adapt/correct your vexpression :/ I made a trigger, with type : VEXpression and entered this: (knowing it couldn't be that straight) // setting i@trigger to 1 will enable// setting i@trigger to 0 will disablei@trigger = length(@P - point("../grid", "P", target_ptnum)) < tolerance; but I bet I need something more like if length(@P - point("../grid", "P", target_ptnum)) < tolerance; then i@trigger=1 and define target_ptnum ? as it seems to be unknown to houdini. and define tolerance too ? I don't even know how to do that. I should have said that I'm totally new to houdini and writing VEX or any other kind of script language... Edited February 16, 2016 by 6ril Quote Link to comment Share on other sites More sharing options...
6ril Posted February 16, 2016 Author Share Posted February 16, 2016 tried this: tolerance = 0.5;If length(@P - point("../grid", "P", grid_ptnum)) < tolerance then i@trigger = 1; no luck it's telling me about the "minus" after @P -> Syntax error, unexpected '-', expecting identifier I didn't bother posting a hip file, as my goal is very easy to describe, but if you guys thinks I should, please let me know. If someone want to help with a VEXpression, the agents walk to a target named grid. all the rest is standard. Quote Link to comment Share on other sites More sharing options...
cwhite Posted February 16, 2016 Share Posted February 16, 2016 In your case it sounds like the goal point number for each agent is the same as its own point number? So it should look like: float tolerance = 0.5; vector goal_pos = point("../grid", "P", @ptnum); i@trigger = (length(@P - goal_pos) < tolerance); 1 Quote Link to comment Share on other sites More sharing options...
6ril Posted February 16, 2016 Author Share Posted February 16, 2016 (edited) thanks Cameron, I'm almost about to understand you VEXpression ! That's motivating I just tried, it doesn't work. so here is the file, if you have the time to look at it, thanks! (might not work since I didn't include the agent folder ? ) with your last VEXpression, it gives weird results, one agent isn't even moving, and all the others reach their point, but don't trigger to the stop state (stand clip) trigger_test.hipnc Edited February 16, 2016 by 6ril Quote Link to comment Share on other sites More sharing options...
6ril Posted February 16, 2016 Author Share Posted February 16, 2016 I manage to achieve exactly what I want with the trigger -> object distance (point cloud), and a very very low comparison value (0.01) so it triggers only if an agent gets very close to ANY point. But, it works because there low chance that an agent would get that near to points which aren't its goal (point with id not match the agent id). And it works probably because I'm only testing it on a small test scene, with goal points far apart... So I'm still really interested in a better true solution for the triggering method. Quote Link to comment Share on other sites More sharing options...
cwhite Posted February 16, 2016 Share Posted February 16, 2016 Ah, it looks like the path to the grid geometry isn't quite right. You can either do "op:../../grid", since the path can also refer to files on disk, or (the better approach) use the Inputs tab to set e.g. Input 2 to the SOP path, and then use @OpInput2 in your VEXpression (see attached) 1 Quote Link to comment Share on other sites More sharing options...
6ril Posted February 17, 2016 Author Share Posted February 17, 2016 I've tried to change the path with "op:../../grid" giving me : float tolerance = 0.5;vector goal_pos = point("op:../../grid", "P", @ptnum);i@trigger = (length(@P - goal_pos) < tolerance); but it's not triggering. and about the better approch, I'm such a noob that I don't see any input tab :/ I can't ask you to teach me the entire software, you've been kind enough to work on that VEXpression for me. So I guess I'd do some more research and training, so that I'm at least able to use the provided help the forum is giving. Thanks again Cameron. Quote Link to comment Share on other sites More sharing options...
6ril Posted February 17, 2016 Author Share Posted February 17, 2016 WORKS ! with this path : "op:/obj/grid" Cameron, let me bow to you! many thanks ! Feel free to teach me how to add an input tho Man, that's so nice now! It will give me perfect control for my hudge crowd sim! Quote Link to comment Share on other sites More sharing options...
6ril Posted February 17, 2016 Author Share Posted February 17, 2016 brought this VEX trigger back to my bigger crowd sim, and for some reason, it doesn't work there : / clueless. It's a very similar setup, the only difference is the terrain (going down some stairs before reaching the level where the target grid is), and the number of agents... I think... giving up for now... might investigate more tomorrow. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.