Can you detect the direction of a collision?

Hello all, first post! So i’ve just started with Unreal and i’m following along on the [Virtus Learning Hub RPG Series][1] and this video basically gets your character throwing a spell projectile. I’m trying to modify mine to create an AOE “explosion” and the particle emitter i’ve selected has a directional blast effect and its location is spawning just fine:

However, i want the explosion to be rotated to match whatever surface it collides with if it hits a static mesh, like a wall or some hilly terrain:

I’ve been searching everywhere and none of my methods are working. I’ve already set the emitter to use local space, because originally i tried hard-coding rotation and even that wasn’t working, so i know my explosion CAN rotate, i’d just rather not have to hard-code every rotation. Assuming the green arrows are my projectile’s velocity, how do i solve for the red arrow, or the direction of collision?

So i just had an idea but i’m unsure if it is the correct solution, how to implement it, or will work at all. Could i use a line trace? I could potentially cast it starting at my spheres location and have the end follow its velocity forwards to determine what it’s colliding with. I just don’t know what kind of info a linetrace returns. does it return something like a normal? I’ll be working on this until someone says otherwise.

When a hit occurs, you have a node, BreakHitResult. In this node are four vectors, Location, Impact Point, Normal, and Impact Normal.

Rotating the projectile to the surface would be Impact Normal. And this would occur at the Impact Point.

Keep in mind that Location is the level location of the actor that was hit, and is not necessarily where the projectile hit.

242293-breakhitresult.png

So I actually just solved this, and i’ll drop my method here for everyone to tell me how overboard i went lol.

After pulling my hair out for the past few hours, i figured out kind of what the problem was. Here’s my solution:

Here, I’m doing what i suggested to myself earlier and starting a linetrace from the position of my collision sphere, TO that location plus some velocity (predicting its path) to find out exactly where it will collide. Its OutHit> gave me the rest of the data I needed.

Getting it’s spawn location was easy. Finding it’s rotation was driving me nuts becasue it kept orienting in completely random ways and I couldn’t figure out why. I knew it was going to be a look-at of location and normal. Basically through writing values to the screen, i figured i needed to rotate my blast -90Y degrees and THEN add it to the normal (still unsure why, but it works).

I wasted all day on this, and there’s probably a simpler method, but it’s done.

Thanks! I basically did the same thing with a linetrace because i don’t really know what the difference is between OnHit and OnOverlap, which is what I was using. For some reason my collision wasn’t firing of all the time with the OnHit event.