Parentable projectile launcher.

I need to launch an exploding projectile from a gun which will be parented to a moving object. The projectile can be either model or brush, but ideally a brush. The projectile needs to explode on impact with anything it hits, and of course “spawn” relative to the parented object. What would the best way of doing this be, keeping in mind the accuracy of the launching in relation to the object the parts are parented to?

Also, keep in mind there will have to be multiple of these in the map.

If you’re going to stand any chance of doing this, you really need to be able to figure it out yourself. The VDC will help you.
Since I’m in a good (unsober) mood I’ll give you some hints:

  1. func_breakable is a breakable brush that has some interesting flags
  2. you can make a func_breakable explode on break
  3. Something like trigger_push might well work to launch it.

You can figure the rest out yourself with some playing around.

The func_breakable didn’t work so I tried a func_physbox which worked fine. So, I actually have a working parented physbox launcher.

I’m having 2 problems currently though. The first is the trigger_push seems to ignore the increasing values I am putting in to make the physbox travel faster and duplicating it and making it bigger is having no effect. Secondly, how do I make a physbox so when it explodes it does anything other than 5 damage? Both the explode magnitude and explosion damage/radius things are not having any effect on it.

For the physbox there is explosion damage and explosion radius, try playing with the values.

You could try and raise the scale force for alternative kicks for the trigger_push

“Both the explode magnitude and explosion damage/radius things are not having any effect on it.”

And I’ve tried changing the alternative ticks thing, it’s doing nothing.


Okay, even when Explosion Damage/Radius and Explosion Magnitude are all set to 0 or all set to -1 it still does 5 damage upon break.


Okay “mass,50” in the Override Parameters makes it hit with some force. That works.

I was just about to come in here and say try changing the mass, but it looks like you beat me to it.

I would rather suggest you use a func_physbox with a thruster on the back of it than using trigger_push. At least I’ve had better experiences using thrusters instead of trigger_push.

As for the explosion, you might just as well want to parent an env_explosion to the physbox. It has a lot more options to fiddle around with to get the desired explosion. The physbox would basically trigger the explosion once it breaks.

As for launching the projectile relative to the guns orientation, you can use a trigger_teleport to move the projectile into the gun barrel. Just let the projectile get spawned anywhere BUT inside the gun, that might cause funky physics if the gun is turned around.

Now if you want to use the projectile multiple times, simply make a point_template which spawns the projectile, the thruster and the explosion.

And the last point, having multiple of these guns in the map. There is quite an easy and quick way of doing that: just select ALL components of the gun, that includes the entities that make up the gun and the projectile. Then simply “copy” it and right click on the selected entities in one of the 2d views. Then choose “paste special” instead of just “paste”.

paste special has the neat little ability of making a clone of your entities (it also fixes the entities’ outputs/inputs, so you don’t have to fix those).

If hammer doesn’t seem to provide the right options for you, you could edit the fgd and experiment with flags. Sometimes it works

The last two posts appear to be making the issue overcomplicated. The more complex something like this is, the more can go wrong. Trigger_push is perfectly fine to use for cannon, although very high speeds need to be used for larger objects (such as cars), in conjunction with frictionless surfaces such as snow, or certain sewer textures. The most problematic area will be overcoming friction of the projectile on the surface of the cannon barrel. Either fire it off at a very high speed, or make/use a frictionless surface.

It might be complicated, yes, with a lot of things that can go wrong. But in my opinion once done right it works better than any other system and has many more possibilities to modify or add effects to it all.