Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

[UE4 Blueprints] I need some help.

A topic by Kyle_Katarn created Jun 04, 2017 Views: 413 Replies: 2
Viewing posts 1 to 3
(2 edits)

So my game idea is somewhat simple, 3D puzzle game focused around redirecting spells shot from a wizard to hit a switch on the other side of the room. I've got the reflection of a ray trace working, and I suspect it would work perfectly for fireballs and the like, but I will need ray tracing for a lightning spell, and I'm running into an issue with reflecting mirrors back on themselves. I probably wont design any puzzles to require reflecting mirrors at each other, but it causes issues that the final user of the game may run into (such as rotating mirrors to a new position and crossing paths with the mirror reflecting the current ray to it... it's kind of hard to explain. I'll try and get a video of it happening.

Here's a video of the reflections working.

And here's what happens if you reflect a mirror back on the mirror that's firing at it.

As you can see it sort of loses all the tracing going towards it, and only can regain it if I wiggle the other mirrors around a bit and fire the ray trace at it again.

Here's the initial code I use to get the wizard to fire the trace. (I set the firing boolean to true in the character controller when the space bar is pressed.)

Here's the code I use to get the mirrors to reflect. 

(Right click and open in new tab to see it at full resolution.)

I'd sincerely appreciate anyone's help. I have a feeling that the raytrace hit event on the mirrors is only able to handle one trace at a time, but all edits I've made to it to try and incorporate an array of hits has failed. I really want to be able to stop bumping my head against the wall on this and move on to something else.

(1 edit) (+1)

I would just add a print string after the "set is Hit" node and look what happens, because i could imagine that the "is Hit" variable isn´t updating properly. And if that shows no results I would add a print string infront of the timeline, so you cant keep track of what is happening. Becaus as I understand the Blueprints, the timeline is just used as a triggerable Event tick. And what happens, if you shoot another fire spell into the "broken Mirror"?

Thanks to some help I got on the UE forums, I scrapped the code entirely, instead writing a recursive function using physics materials and custom surfaces that allowed for multiple hits to each mirror.

Here's the topic on the forums in case it's useful to anyone else.

As to your question yeah I had a feeling the isHit variable had something major to do with it, since it would be checking the mirror being hit twice, and replacing the line trace going to the mirror shooting back at it with the new line trace reflecting the mirror shooting back at it. If I stopped shooting, it would still be firing off a line trace from the effected mirrors, until I shot again.

This new way scraps all those concerns and even allows me to control how many total bounces there can be in the game.

Thanks for the suggestions mate!