Crowd solver transition not using random offset

   2312   7   4
User Avatar
Member
45 posts
Joined: Nov. 2019
Offline
Hello,

I have a crowd sim that is made of agents starting in T_pose that I want to randomly transition into multiple random clip. Everything works fine but I also want to pick up a random clip time of their new state (so that they don't start walking with the same foot for instance).

In the agent State node in my crowd solver their is a random clip offset slider but it only works if the simulation start on this specific state (which I do not want). I know I have a some options like delay transition and such but because I run a vellum sim on top I would need to keep everything to a minimum warm up time.

Any help appreciated.
Thx,

Edit: with a small scene to illustrate my issue.

Edit: Solution in a video tutorial available here https://youtu.be/H-7E_F0W-O8 [youtu.be]
Edited by Edmond BG - July 8, 2021 02:51:47

Attachments:
crowdSyncIssue.hipnc (1.2 MB)

User Avatar
Member
6 posts
Joined: Sept. 2017
Offline
this is exactly the issue I am running into now, hope someone who knows what's up sees!
Edited by mmaduri7 - April 30, 2021 17:33:43
User Avatar
Member
45 posts
Joined: Nov. 2019
Offline
Hey, here is the best work around that I found :

-put a multisolver after the crowd solver
-edit the clip times array using a pop wrangle

you can choose what is the the target cliptime after the transition and add a random offset using rand(@id), hope that helps.
see hip file
Cheers.
Edited by Edmond BG - May 1, 2021 01:02:04

Attachments:
crowdtimeoffset.hiplc (588.3 KB)

User Avatar
Member
6 posts
Joined: Sept. 2017
Offline
This is really awesome thank you!!

I was able to plug in what you did, thank you so much for attaching the scene.

Would you mind just breaking down the VEX part for me? I can see it works but I just want to know what the inputs are there so I can adjust as needed. I'm not great at translating VEX to English. This really is awesome, thank you again.
Edited by mmaduri7 - May 3, 2021 12:59:12
User Avatar
Member
45 posts
Joined: Nov. 2019
Offline
Glad it helped.

Regarding the 3 line of VEX here is what you need to know :
-The crowd solver puts a clip times array attribute on each agent, buy default there is only one value : the current clip time of the clip currently playing on that agent. The time loops based on the length on the clip and the time scale of the solver.
-During a transition there is suddenly 2 values : the clip time of the current clip and the clip time of the target clip.

So when you check the length of that array it will return a length of one if there no transition going on or a length of 2 if there is a transition going on. And the VEX code operates so that if there is 2 values
if(len(f@cliptimes)==2)
then set the target clip time to a random value plus the time
f@cliptimes=rand(@id)+@Time;

And at the end of transition the target clip times becomes the current clip time, the length of the array goes back to 1, and the clip time will loop normally.

Keep in mind that the pop wrangle runs on each agent independently so you can have agents that are going through a transition and some that are not and everything will still works perfectly.
Edited by Edmond BG - May 4, 2021 01:07:26
User Avatar
Member
6 posts
Joined: Sept. 2017
Offline
awesome thank you so much for the explanation! this is super great
User Avatar
Member
45 posts
Joined: Nov. 2019
Offline
For those still having this issue, I made a video tutorial on how to solve it : https://youtu.be/H-7E_F0W-O8 [youtu.be]
User Avatar
Member
86 posts
Joined: Oct. 2015
Offline
Great! This'll come in handy. Thanks for sharing the tutorial.
  • Quick Links