Crowd firing weapon mutual relation

   286   1   1
User Avatar
67 posts
Joined: April 2014
I am trying to setup a crowd sim where each agent can fire a weapon depending on their state, and when they fire it create a particle which would travel and ideally hit either a wall and die or another agent a trigger them into a ragdoll. I am fairly new to crowds but I got the particles triggering the ragdoll down, I am just trying to find the best approach for some of the other requirements.

#1. Controlling when each agent would fire their weapon.
I was thinking of parenting a grid at the muzzle of each gun and add that as a layer to the agents. I am doing that for the gun, but the grid would track the transforms for where the the weapon projectile would start. I would also add some type of parameter on those grid for the rate of fire, then limit that animation to specific states so the weapons are not firing all of the time.

#2. Emitting a particle for each weapon fire
The muzzle grids from #1 would then be unpacked and used as a point emitter within the same dop network as the agents. The problem with this is that I am having trouble singling out the muzzle grid I added without unpacking the agent every frame, which is not desired.

If anyone has any better direction on this please let me know. Again I am pretty new to crowds and would love to know a better way to do this.
User Avatar
1949 posts
Joined: June 2008
You can drop some code into a Primitive wrangle and extract the bone points, without unpacking.
matrix prim_xform = primintrinsic(0, "packedfulltransform", @primnum);
for (int i = 0; i < agenttransformcount(0, @primnum); ++i)
    matrix world_xform = agentworldtransform(0, @primnum, i) * prim_xform;
    addpoint(0, set(world_xform.wx, world_xform.wy, world_xform.wz));
You could use a bone for the weapon and position the tip of the bone at the end of the weapon. This could get you a firing point. I'm not sure how to link triggering from a crowd sim to a standard particle system emission. Perhaps you'd have to run the entire crowd simulation through a full timeline time shift, then present the resulting firing points as an emitter source for the particle system.
Using Houdini Indie
Ubuntu 18.04 48GB Ryzen 16 core.
nVidia 1070GTX 8BG RAM
  • Quick Links