Hello. Im working on my small learning project where i put some things that i can learn. Lately i’ve been doing some weapons for the player to use. I’ve created a hitscan machinegun, that shoots a line trace from a barrel point that is a scene component. Here is how it looks like: Imgur: The magic of the Internet
The trace start is in the location of this scene component called barrel, and the end is certain amount of units away, coming to the center of the screen (a crosshair). Im having few issues as seen here, on my video:
Here i spawn another actor that is actually a projectile (spawned at the start of the trace) that’s linear velocity is set to a certain amount so it actually falls to the ground if it doesnt hit anything (its purely cosmetic) but it seems like, when im moving either left or right, the cosmetic trails/projectiles that i spawn from the gun seem to be a bit off to the left or right side (depending on where im moving), and not exactly from the barrel point.
Can somebody please answer me what am i doing wrong here? Should i change it to some better solution - and what that would be? I can also post the blueprint of my machinegun if it will be needed.
Please, i kindly ask for tips, i really have no idea what can be the reason of this issue.
I had quite the same problem with my character thorwing glowsticks while moving. I think it’s because, when you spawn the bullet, it spawn at the place where you character was when you pressed the key. So, if you’re character is moving, there might be a little offset between the character and the bullet. For me, I did a “Attach actor to actor” after the spawn actor, and it works, but I have some problems with collisions now x)
After, it might be something else, you can try with an attach node, but it looks similar ot what I had
Lateral movement velocity seems to be a bit fast when firing. Most games will limit (slowdown) character movement speed and mouse yaw/pitch when shooting.
Your projectile speed is too slow in my opinion. I’d increase it quite a bit. Take for example an M416. It has a muzzle velocity of 880 m/s, so projectile speed would be 88,000 cm/s. I’d also only do a tracer (visual effect) on every other or every 3rd shot (modulus)…and reduce the size/shape of the tracer to more accurately represent the projectile (bullet).
A muzzle flash would also help hide the lateral wave effect. Overall it’s doing what it’s supposed to.
The thing is… I really dont want to limit player’s speed when he is shooting. Im not looking forward to create a CS like shooting system, but rather a quake3 one. Its been 5 days, im still scratching my head how the hell i can do this… I tried to attach one hitscan to the player, in a event tick and on shoot spawn actor in the location of the actor. But it didnt work either. Now i wonder how can it actually work. i tried decreasing the size of the tracer, but it didnt change anything honestly. Is there anything else i can do? Thank you for your answer
Hi, so i tried something like that, but it doesnt seem to work… Did i do something wrong? It should attach to the self (a weapon actor) after being spawned, and after that its linear velocity should be set… Imgur: The magic of the Internet
Hi. To anyone curious, i actually went for a different approach with spawning not a projectile, but a niagara particle system (a beam, stretching out from the beggining of the line trace till the end of it) and attaching it to a barrel point while spawning (used spawn system attached node), and configured it so it actually feels decent. Its still not perfect, but i believe i can work with that to actually create something good.