- Unreal Version: 5.0.0
- Template: First Person
- Project Name: MyProject
Big credit to the Shooter Game Project. It's a wonderful learning resource. I just tried to split out the weapon fire projectile code and simplify it so I could better understand it.
-
Change Projectile Gravity Scale to
0and set Initial Velocity in Local Space tofalse. Path:Content/FirstPersonCPP/Blueprints/FirstPersonProjectile
-
update the HUD.cpp file so the crosshair is in the center of screen. The crosshair texture is 16x16 so I adjusted it by 8 units in each direction on line 28. I think it's purposely off-center in the template to be more aligned with the yellow projectile, but I'm really not sure I could wrong.
-
update the projectile files with an
InitVelocityfunction. -
MyProjectCharacter.h - lines 141-148
-
MyProjectCharacter.cpp- lines 149-180, and lines 315-351. you might have to include gameplay statics in your character file. I'm not sure, I didn't have to, I assume it's included by default. But if it throws an error,
#include "Kismet/GameplayStatics.h"on line 14 might be necessary, but I can't confirm.
