How to ghost/fly with your character as debug

Hi!

I’m trying to add a simple debug tool for my game where I can for example click the left and right thumbstick on a gamepad and enter ghost mode. What I mean by that, is that when this ghost mode is enabled, I want to be able to go through any wall, but also fly. What I mean by fly is pretty much move around like I can while in the editor when I’m not playing.

But, what I also want is that if I click the left and right thumbstick again, my character gets moved to where I moved with the camera while ghosting and take back control of the player. That way I can move very fast through a level to test some specific things.

I tried to use a FlipFlop that either executes the console command ‘‘ghost’’ or ‘‘walk’’. The problem is that ghost only makes me go through walls but doesn’t let me fly around like the editor camera. I also tried to execute the console command ToggleDebugCamera, which controls like I want to, but then no pad input seems to be registered to get out of it (I think it overrides every controls). If there’s a solution to this, it would bring me closer to what I’m looking for, I would only need after that to get a reference of the position of that debug camera and teleport the player there.

Let me know if you need more info/precisions!

Thank you!