I have a problem with triggering an event. I want to turn something on when my pawn is inside a custom trigger geometry, and off when it’s outside. Sounds simple, maybe I’m missing something obvious.
I’m using on end overlap, or begin, it’s the same problem.
It works, except when you change direction while being overlapped.
Here’s a picture:
I thought having a delay before it resets to being active might be a bit unreliable. I thought I could have a point, like and empty actor to trigger with the geo, as opposed to the mesh of the pawn, but I couldn’t figure out how to do this. I tried a very small sphere, but it had to be very small, which made it unreliable. Adding substeps seemed to make it even more unreliable for some reason. Maybe a volume would be the answer, but this is procedural geo created in another program on a large scale.
I found some posts about finding if a point is inside geo with “get closest point on collision” node, but the geo needs to be convex.
I thought getting the dot product of a line trace direction and the hit face normal would work, but the hit face normal was always pointing towards the camera, so I couldn’t tell if it was a back face or a front face.
I could make it trigger onBeginOverlap and make it impossible to change direction until onEndOverlap occurs, but that could also be unreliable - if you hit it at a grazing angle for example. I’m hoping there’s a better solution.