Sphere Trace continues tracing from old cameras even after the Gate is closed.

I’m working on a dynamic camera system where each camera is activated by entering a trigger box. When the player exits the box, the camera begins a Sphere Trace (visibility trace) to check if the player is occluded, and I use a Gate to control when tracing is allowed.

Everything works except one major issue:
Sphere Trace continues tracing from old cameras even after the Gate is closed. So there is many ghost sphere traces when I see the gate is closed when debug

Make sure the gate is closed. Having multiple objects with the same BP makes it hard to distinguish one from the other.

Can you replace the trace with (or just add) a print string of the camera’s name to see which one has an opened gate?

Try creating a manual variable IsActive or better yet just set the whole actor to not tick instead and see if that works.

:red_exclamation_mark: Even though the new camera starts tracing correctly,

The old cameras never stop tracing.
They keep firing SphereTraceByChannel from their old Start locations.

It seems like the trace loop continues running inside the old camera blueprint even after I close the Gate.

I have tried:

  • Closing the gate before tracing

  • Closing the gate after tracing

  • Closing the gate both inside and outside the trace logic

  • Setting booleans to block trace

  • Disabling tick

  • Moving the trace code behind a DoOnce

  • Resetting the DoOnce

  • Making sure only one box overlap is active

All the cameraBlueprints are copies I test to do hardcopy of BP and attach it. Same problem new camera stsart trrace nicely byt old one is active.

Can you place a breakpoint on the CloseGate event?

Is it even called? Maybe you are loosing the reference to the camera when trying to call it.

Can you show the BP where you are calling the event that closes the gate.

Or is my logic wrong. I try to close the gate always when entering a new box to and then spawn the current camera.

Yea - here it is:

When you Begin Overlap you try to close the gate on “self” which is the actor you started overlapping with. Not the one that was previously active.

You need to somehow get a reference to the currently active camera actor to call Close Gate on that.

Probably you just need to store it in the player pawn or controller and make the switch from there: Call an event “Change Camera” and pass the new camera to the controller/pawn and let it disable the old one and activate the new one.