[SOLVED]Play A Crowd Animation 1x?

   3024   4   0
User Avatar
Member
2536 posts
Joined: 6月 2008
Offline
Hi All,

I am trying to detect when a crowd system agent clip has completed. There are some attributes like crowdtransition_occurred to help with this task but I find the current attributes in H14.396 to be very unreliable.

For instance @stateduration is not really how long you have been in the current state it is the amount you have traveled through the clip time. Which is a little different because if your clip has looped then @stateduration resets even though you remain in the same state. Thus the @stateduration is not reliable for really detecting how long you have been in a state because it can reset at any time.

How do you make an agent play it's animation 1 time? In my case it is a fall to the ground. So it is vitally important that the clip does not loop at all. If a loop occurs the agent suddenly jumps back up after being on the floor.

I can't seem to find a way to force a clip to NOT loop?
Edited by - 2015年9月28日 08:25:37
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
53 posts
Joined: 8月 2009
Offline
I am surprised to hear what you say on stateduration, I've not found that to be the case. The simplest answer is to keyframe some stillness into the end of your clip you would then be able to use stateduration to transition to a state where there is no animation. I may have misunderstood your problem.
Peter Quint
User Avatar
Member
2536 posts
Joined: 6月 2008
Offline
Thanks for the reply, I am attaching a simple example file that demonstrates the problem. I use VEX code to determine the end of the state and activate the i@trigger flag.

I can't really put ‘stillness’ into my clips. I am working on a combat engine and I need to be able to transition from clip to clip without ‘clip-padding’. For instance an agent could be fleeing and an archer shoots him in the back. The fleeing agent needs to transition to dying once hit, and not continue running.

I have included the agent bclips so you should be able to just play the animation and observe the error. The agents starts dying then falls to the floor and the pops up momentarily then finally dies. I want to avoid the pop-up portion of the animation. It is not needed/wanted.

I can lower the multiply detect for end of clip down to 0.65 from 0.99. This will work in this one scenario but what happens when I start having random time offsets? I can't rely on a fixed constant multiplier in that situation.

Attachments:
Untitled-2.jpg (134.2 KB)
crowd_loop_1x_problem.zip (1.8 MB)

Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
7715 posts
Joined: 7月 2005
Offline
I think there's some different interpretations on how the animation wrapping should be done. If I just examine the dying animation in an Agent SOP, then I can see that the last frame of the animation is frame 35. However, when I playback through the crowd solver, the cliptimes are being reset to 0 *at* frame 35. So at the very least, you need to switch states at one frame less than the clip length. The other problem is that the clip baking is at the *beginning* of the frames, so the returned clip length is actually 1 frame longer than what you'd expect.

So to get your file working I changed the @stateduration test to:

if (@stateduration > (my_clip_length - 2.0/24.0))

PS. On second thought, the extra frame offset might be required because the state doesn't change until the next frame.
User Avatar
Member
2536 posts
Joined: 6月 2008
Offline
Thanks for looking into this. I got some insight, myself, by diving into the Crowd Solver and taking a look at that code. Even the Crowd Solver is removing one @TimeInc from length for it's processing. So I ended up subtracting (@TimeInc * 2) from my_ cLip_length to detect wrap around or looping.
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
  • Quick Links