"Extend" line trace trough another actor

I have a line trace based hit detection for weapons. I want a blood splatter to appear behind the actor when they’re shot. For that I need to do a line trace to a) make sure there even is a wall to put the blood on and b) get the angle of the wall so that the decal is applied properly.


What I need to do is to get the point where the gun hits, get the direction of where the shot was fired from, then create another trace in the same direction from actor.

Is this possible?

There is such thing like MultiTrace that cast a single trace that return all the hits it had, not just the first one.

From there you can check the first hit for “is it damageable unit” and if it is, check the following hits for “is it a valid wall”

After trying out different search terminologies, I found an answer in a Reddit thread. Here’s how I did it, for those who find this post in the future:
Firstly, get direction out of your trace like so:
image
Get both this direction and “Location” vector from your trace to the target actor, using interface for instance:
image
Then multiply direction by your desired length and add that to the impact location.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.