This is more of a how would you do it thread and not a problem. Looking back at previous games how would you recreate the Pulse/Plasma rifle from Turok, or the Plasma Rifle from Doom? I would assume its a line traced or should I spawn a projectile with the effect attached to it?
I suppose it depends on which version you want, but I’d do a line trace and spawn a particle beam from the gun offset to the endpoint/hit location. If it hits something spawn another particle system at the hit location to show the “explosion”.
1.Add socket to your character’s skeletal mesh at the place you want the weapon to be.
2.Attach the weapon to the socket.
3.Spawn a projectile from the sockets location with the rotation of the camera from the PlayerCameraManager.
spawn(projectile_actor, socket_location, PlayerCameraManager->Rotation ) ( This is not the right syntax, just an example of how to do it ).
4.Use delay node to make intervals between projectile spawns. ( LeftMouseClick->Delay[w/e]->spawnActorOfClass ) *In Blueprint ( There is no delay node in c++ ).
Also in the projectile BP, make sure that in the EventBeginPlay you cancel collision with the instigator ( which require you to feed the spawn function with the player’s pawn. ( spawn ( w/e…, self ) ).
You can find the Instigator projectile BP by searching for “Instigator” in that menu that comes when you press RMB inside the graph (where you search any other variable/function you want to use ).
The projectile BP should have something like that: EventBeginPlay->CancelCollisiton(Instigator) ( Again, this is not the right syntax ).