Hello, I’m trying to make a 3rd person shooter with ALS as my first project with this engine.
When I shoot, a line trace that goes from the weapon’s muzzle to where the camera is looking at is generated. If it hits an enemy it should ALWAYS damage it.
For some reason that I can’t figure out, the line trace sometimes works as it should, but most of the times it seems like it collides with enemies but nothing happens.
I’ve tried tweaking the collision preset of the enemies to make sure it blocked the line trace channel (I made an specific channel for the bullet line trace), I also ticked the “always create physic state” button in the enemy BP, but nothing is working.
Here is a quick video showing the line trace BP function and gameplay where the problem happens: https://youtu.be/Pv8rxL29c5k
You’re doing a pixel perfect trace, try adding a little bit of slack to the end of the trace, mainly your second trace that takes in the location of the first trace.
You need to slightly extend the second trace, because your end location is exactly on the surface - that can lead to precision problems (i.e. in time between traces enemy will move away by 0.0001 unit - and your trace now won’t reach it)
First trace goes straight from camera location and it sets the end point of the second trace in case it hits an actor.
Second trace goes from weapon muzzle to the set end point by first trace.
I do it this way because sometimes the first trace hit things that are between the camera and the character. I’m not sure if it’s the best way to do it to be honest, but I couldn’t think of osmething better at the time.