Atom Posted April 22, 2018 Share Posted April 22, 2018 (edited) Does anyone know hot to alter the @gait_speed attribute, using VEX, found under ClipProperties? By default, the PopWrangle can only modify Geometry based attributes. Edited April 23, 2018 by Atom Quote Link to comment Share on other sites More sharing options...
Atom Posted April 23, 2018 Author Share Posted April 23, 2018 (edited) Even the concept of controlling velocity seems to be messed up. Here you can see my agent stops forward motion when I explicitly set velocity to 0. And here I don't see any slow down when I greatly reduce velocity via multiplication. I expected to see some slowdown in movement along the Z axis I am able to affect clipspeedmultiplier, on the CrowdState node itself, when my agent passes through the box area. if (@group_slow_area==1) { clipspeedmultiplier = 0.25; } else { clipspeedmultiplier = 1.0; } But I also want to cause the forward speed to slowdown as well. Velocity is a read-only attribute in this CrowdState Vex code snippet context or I could try... if (@group_slow_area==1) { clipspeedmultiplier = 0.25; v@v *=0.25; } else { clipspeedmultiplier = 1.0; v@v *=1.0; } So the above code is the intention, but how to implement it in the DOPs network? Edited April 23, 2018 by Atom Quote Link to comment Share on other sites More sharing options...
Atom Posted April 23, 2018 Author Share Posted April 23, 2018 (edited) Ok, I think I have figured out a bit of the problem. Basically you need to turn off Limit Particle Speed To Gait Speed Range on your Crowd State nodes if you plan on controlling the velocity directly with VEX. Here is a slowdown based upon recursively reducing velocity until the agent nearly stops. if (@group_slow_area==1) { v@v[2]*=0.998; } else { v@v=set(0,0,1); } Here is a slowdown based upon a direct setting of the velocity value. if (@group_slow_area==1) { v@v=set(0,0,0.25); } else { v@v=set(0,0,1); } Edited April 23, 2018 by Atom 2 Quote Link to comment Share on other sites More sharing options...
Atom Posted April 23, 2018 Author Share Posted April 23, 2018 (edited) Skating is the result of the ClipSpeed being out of synch with the particle velocity. To remove the 'skating' you see in the recursive velocity reduction, shown above, you must add a new attribute to the agent to remember what the last speed multiplier was set to.Then the clip speed will slow down in the same manner as the velocity. A 'truer' slow motion. PopWrangle code. if (@group_slow_area==1) { v@v[2]*=0.998; f@last_speed_multiplier *= 0.998; } else { f@last_speed_multiplier = 1.0; v@v=set(0,0,1); } VEX Code Snippet on CrowdState if (@group_slow_area==1) { clipspeedmultiplier = f@last_speed_multiplier; } else { clipspeedmultiplier=1.0; } Edited April 24, 2018 by Atom 2 Quote Link to comment Share on other sites More sharing options...
gweiss Posted April 30, 2020 Share Posted April 30, 2020 Hi Atom, that is very cool! thank you for that can you please explain where do you create the "@group_slow_erea" attribute? is that on the box geo that triggers the change? Thanks G Quote Link to comment Share on other sites More sharing options...
Atom Posted April 30, 2020 Author Share Posted April 30, 2020 @group_slow_area is not an attribute. You use "@group_" as a prefix to reference a group. The group is actually named "slow_area". Place a PopGroup after your crowdsouce and fetch in your grouping geometry using the Bounding tab to specify the SOP path to the box. Quote Link to comment Share on other sites More sharing options...
gweiss Posted April 30, 2020 Share Posted April 30, 2020 Amazing! Thanks so much! Cheers Quote Link to comment Share on other sites More sharing options...
gweiss Posted May 1, 2020 Share Posted May 1, 2020 I'm actually getting an error when adding this snipet to the crowd state any idea why? am I doing something wrong? I've added the pop group like in your example. Thanks G Quote Link to comment Share on other sites More sharing options...
Atom Posted May 1, 2020 Author Share Posted May 1, 2020 (edited) A VEXpression is different than a PopWrangle. In a VEXpression, you assign attributes to interface controls. Hover your mouse over the interface element you want to control and read the label. That is the name of the variable that you can reference inside the VEXPresion code block. In your posted image, this could work. clipspeedmultiplier = length(v@v); I don't think VEXpressions can write to attributes, but they can read them. Edited May 1, 2020 by Atom Quote Link to comment Share on other sites More sharing options...
gweiss Posted May 1, 2020 Share Posted May 1, 2020 thanks! and if I want to use a PopWrangle I plug it after the state node? Thanks G Quote Link to comment Share on other sites More sharing options...
Atom Posted May 1, 2020 Author Share Posted May 1, 2020 (edited) Here is my node network. Edited May 1, 2020 by Atom 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.