I currently have 2 weapons in my game. A machine gun and a crossbow. I’m trying to make them react to various types of materials depending on what they hit.
The machine gun uses line traces with a random cone of inaccuracy that increases over time. The line trace results in a hit that gives me all the information I need including the physical material. This permits me to spawn the appropriate particle system.
The crossbow shoots arrows using projectile components. The direction of the arrows is determined by a line trace, but then they are released and the line trace isn’t used anymore. Since gravity takes over they fly in an arc and won’t necessarily hit what the line trace said it would. I use event hit to detect an impact and apply damage to the actor that was hit. However the physical material comes up blank.
Are there any suggestions as to how I get the physical material that the arrow hit? The only thing I can think of is a line trace from the present location with extremely short range called on each tick. Once the line trace hits something remember that until the arrow stops. That seems like its potentially slow and unnecessary since I should know what I hit and what type of material.