Do line traces generate hit events?
I'm participating in a small game jam to do with mirrors, and while bashing out a prototype for my idea I've hit a snag to do with line tracing. The final product will probably not have or need line tracing but it's probably the easiest thing to test with currently.
Anyway, the idea is to have the mirror bounce whatever hits it in the opposite direction (think of it as one of those laser puzzles), I tried to do this with some loop logic with my wizard character who's supposed to be shooting the things that'll bounce off these mirrors, but I ran into some problems to do with infinite looping, so I thought to let the mirrors themselves handle the hit logic, so when the mirror gets hit with the raytrace, I'll use OnComponentHit to handle the bouncing, but the initial ray trace doesn't seem to generate a hit event on whatever the cast hits. Is there a way to force it to happen?
My code is just a simple line trace by channel but I'll include it anyway. Just using the impact point of the hit to reverse the normal to generate a new direction for the new line trace, as you can see I've set a break point there but it never gets triggered, and I can't find something in the editor itself that indicates whether a component can have a hit result generated by a line trace.
asked Jun 02 '17 at 05:02 PM in Blueprint Scripting
I ended up writing my own function instead of using OnComponentHit. That will probably be useful for when I implement fireballs and actual projectiles and the like but it wasn't what I needed here. So I wrote my own function and passed the hit result from the initial line trace into it and worked from there to get the proper relfection bouncing working.
answered Jun 04 '17 at 07:24 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here