Unexpected behavior with OnComponentBeginOverlap (UE5)

Reddit thread containing video example

I’m running into some unexpected behavior with a door trigger. Here’s what’s happening in the video:

A laser (static mesh with simple box collision) is shot towards the green sphere but is blocked by an object. When the laser hits the green sphere, the sphere opens the orange door. The green sphere’s blueprint has a sphere collider around it that implements OnComponentBeginOverlap and EndOverlap. In the event code, I check to see whether the overlapping component is the laser static mesh, and if it is, open the door. This works mostly, but you’ll see in the video that when the laser beam is blocked by the metal object but gets somewhat close to the sphere, the OnOverlap event fires.

The laser beam is created by scaling a 1-unit long static mesh along the X-axis every tick. I thought that maybe the laser static mesh collision was scaling further than the static mesh itself, but as you can see towards the end of the video (although it’s maybe hard to see), the box collision on the laser static mesh doesn’t extend past the end of the laser.

Some screenshots of the code:


Logic to scale the laser static mesh every tick


Sphere collider’s OnComponentBeginOverlap implementation

This has me really stumped. Any help would be appreciated!

Wouldn’t it be easier to just fire line traces from the laser to the sphere, in order to check if the sphere got hit?

Simply a LineTraceByChannel and a cast of the hit actor to the sphere, if not failed, the sphere is activated…

2 Likes

Yeah, I ended up doing it this way and it works with the line trace. At this point I’m just curious as to why the collision wasn’t behaving as expected. I wonder if it’s an engine bug or intended behavior when actors are scaled in real-time.