Building basic instant-hit weapon in FPS template

Hi!

I’m trying to build a quick weapon to use in my scene. I first figured I’d try to just drop in the Shooter Demo weapon (the instant-hit rifle), but looks like it was a C++ project, and the instant-hit logic was coded there. What would be a good way to approach building a sort of raytrace weapon within blueprint? I should mention, the element of my scene so far is blowing apart Destructible Meshes, which the FPS template projectile works fine for, but I’d like it to be an instant hit instead. Could I simply perform a raytrace on the focal point of the camera and create a physics impulse on colliding objects?

Many thanks!

Hello,

You will want to check out this forum post that has a trace weapon built from the FPS template:

Also included is how to do a rapid fire weapon.

You can have it spawn an impulse at the location of the object hit by the trace in the same way that the basic FPS projectile does it with an “On Hit event” but with the trace function instead.

Let me know if this helps.

This is incredibly helpful ! Thanks!
Got my weapon all set up but having some issues with adding the impulses. Here’s what I have at the end of the Fire Gun function. Trying to cast to a blueprint that contains a destructible mesh.

I’d like to just set up an impulse wherever the raycast lands, is that possible with Add Impulse at Location? I should also mention that the destructible mesh has its collision preset set to overlap on camera trace response.
Many thanks!

For what you are doing, you are better off skipping the Cast To part (that was for targeting a specific actor) and just doing a general Apply Radial Damage. Plug the Hit Result’s impact point into the origin of the Apply Radial Damage.

That will hurt people and break meshes very simply. Here is an example from one of my guns:

16410-destruct.jpg

You can add an Add Impulse At Location as well, but just use the Hit’s output, you don’t need the specific destructible mesh as the target. Hope this helps, let me know if that gets you going in the right direction.

Ah that node works much better. Thanks so much mate!