Hello,
I’m working on a light beam puzzle (similar to “LIT: Bend the Light”[LIT: Bend the Light - Full Game Playthrough (No Commentary) - YouTube].)
The puzzle as it stands uses line traces to handle beam collision and puzzle logic, but under certain circumstances, a line trace can pass straight through a static mesh, and I’m not sure how or why.
As an example, let’s say I have 3 actors:
The Source - the actor that generates the beam
The Mirror - the actor that will reflect any beam that hits it
The Wheel - An actor that the player can turn clockwise or counterclockwise. The Mirror is attached to it in level, and so the Wheel turns the Mirror.
When the Source first fires, everything works as expected. I do a line trace from the Source to the Mirror, the trace hits the Mirror where I expect it to, and the Mirror shoots out a new reflected beam from the point where the trace hit its surface.
However, when the Mirror is turned, the impact point changes, so I tell the Source actor to do another line trace to get a new, more accurate collision point.
I do this via Blueprint Interfaces. When the Wheel starts turning, it notifies the Mirror. When the Mirror receives this notification, the Mirror, in turn, notifies the Source. When the Source receives this notification, it begins performing traces (as described above) on tick. When the Wheel stops turning, it sends a “stop” notification down the chain, and the Source stops ticking.
However, when the beam is being refired on tick like this, it will pass straight through the Mirror every three ticks or so.
I’m really not sure why this is happening. Here are a few avenues I’ve explored so far:
-
Collision Profiles - These have all been checked, and seem fine. I’m just tracing against world dynamic, and all the meshes of all the actors that are a part of this puzzle are all set to world dynamic. At a later date I may move them all over to a custom collision channel, since there are many other actors in the level that aren’t involved in this puzzle whatsoever.
-
Flaws in Mesh Collision - While I do have custom static meshes with custom simple collision meshes, I also tried using the standard Unreal Engine Cube, and it has the same problem, so I don’t think my custom meshes are the issue.
-
Tick Groups - Initially I suspected that the Mirror being moved and the trace being performed may happen in the wrong order in a given tick. I’ve tried changing up tick groups, both for the whole actors and for the individual static mesh components as well. I’ve had no luck so far.
Any advice would be appreciated.