Shooting (Spawning FX and geo)

   2035   1   1
User Avatar
Member
3 posts
Joined: Oct. 2016
Offline
Hi

I was thinking about way to create shooting inside houdini
What I mean by shooting is spawning bullet, spawning muzzle flash and some presimulated smoke.

How I imagine I would control it: some animated parameter set to 1 at frames when it need to shoot.
But inside houdini everything is recalculated each frame, so it's not that straight-forward.

For bullets I can use particles and there is a way to spawn them and having them alive at next frames.

But what about flash and smoke? may be I could use different particle system for that, just spawn one and animate effect using particle age?

What is the common way?
User Avatar
Member
191 posts
Joined: Oct. 2018
Offline
I figured I'd give this a go to try and redo a setup I worked with last year that had a bullet sim and muzzle flashes.

For the bullets you could set them up 2 ways:
1. Given a start and end frame you can specify a constant rate of fire, and in vex calculate the number of bullets and add them using the addpoint function. Then calculate their activation frame based on the rate of fire.
2. Manually add the number of bullets you want to fire and specify the activation frame. A quick way I've used before is to write in a string parameter your frames then convert that to an array.
//The number of frames entered must be greater or equal the amount of points
string activation[] = split(chs("frames"));
i@activationFrame = atoi(activation[@ptnum]);

Both ways you can set a normal on the points for their firing direction then point deform them or whatever to your gun anim. Then you can set the velocity by the normal. After you have your bullet points you'd have a wrangle that removes any points if the frame doesn't equal the activation frame, then in a dopnet have your pop source set to all points and impulse activation to 1. That will give you your bullets sim.

For the muzzle flash, you can take your bullets sim and run it through a solver where you copy the position and normal from the previous frame. This will give you static points where they were shot from. Then you can copy stamp your muzzle flash volume or vdb to those points. The trick here is to stamp the activation frame attribute on the copy stamp and use it in a time shift as an offset before putting the muzzle flash into the copy stamp. So your frame in the time shift would be something like $F - stamp(“../copy1”, “offset”, 0) if your volume starts at frame 1 and lasts a couple frames.
  • Quick Links