How To Make A Gun Shoot

Hello

How would you make a gun shoot in unreal engine using blueprint? Would you raycast then play the flying bullet animation at the same time or just spawn a projectile or what?

Thanks,
Mike

Both are valid options. But when you should use one method over the other depends:

I will give you a few cases for each method:

Projectile spawn method:

  • Use this method when your ‘bullets’ has drop (affected by gravity) - eg: Grenade launcher
  • When your fire rate is low - Eg: Racket launcher
  • When the ‘bullets’ travel relatively slow - Eg: Rocket launcher

Ray trace method:

  • Use this when your bullets are instant hits - very fast moving (simple Sniper)
  • When the rate of fire is very high - LMG/Gattler gun -If you try to spawn 1 proecjtile for each bullet, that is a lot of Projectile actors to process. So you should instead do ray-cast.

When you use Ray-trace method, you can spwn some pretty particle effects to visualize the bullet’s trajectory - Use a beam emitter?

Thanks for replying so soon I’ll try it out tomorrow

Here is the first part to the tutorial. [Part 25]-Custom Gun! Part 1-ish- How to make an advanced FPS game - Unreal Engine 4 - YouTube