It is very useful for debugging and testing different materials to not just have a line trace, but to show the speed of the projectile in the line trace.
Create a GetTraceColor function (pure) which accepts a velocity and outputs a color. You can simply use one lerp to fade from a color at top speed to white at 0 speed, or use a more complicated setup as pictured.
Add a Vector variable LastPosition to the FirstPersonProjectile blueprint. In the ConstructionScript initialize it to the actor location.
Optionally add a TraceDuration variable to universally control the duration of the bullet's trail.
In Event Tick, use the draw debug line function to draw from the last position to the current position, then update the last position variable.
Add a similar draw debug line function immediately after the OnProjectileBounce Event, from the last position to the hit location (with color dependent on the impact velocity). Finally, if the projectile did bounce/did not penetrate, draw a line from the hit location to the current location.
If desired, change the InitialSpeed property of the ProjectileMovementComponent to something more realistic (eg 30,000cm/s).
Also change the life span of the actor to be larger than 3 seconds.
Create a GetNewSpeed function (pure) with inputs for the hit, exit location, and impact velocity. It should return a float.
Energy lost is calculated by multiplying the distance penetrated * a material dependant constant. The bullet's energy can calculated with E=0.5mv^2. The new speed is calculated with a rearrangment of this: v=sqrt(E/0.5m)
You should now be able to test that the projectile loses velocity proportional to the distance it penetrates.