Locking and Unlocking Camera

Okay, it goes like this:
This area on the left side of the pillar the character is facing, I don’t want it to appear.

I wanna make it so that as the character approaches the wall, the camera just “stops following” the player, and instead locks on a fixed position as to not show anything beyond the walls. Something like this:

Got your logic, gonna try to make it into c++ and see if it works

It worked, it’s just too abrupt, I’m gonna try some things to smooth the transitioning. Thanks a bunch!!

I came up with the following solution

if (GetActorLocation().Y >= 590)
{
	CameraBoom->DetachFromParent(true, false);
	this->bAttached = false;
}
else if (GetActorLocation().Y >= 570 && GetActorLocation().Y < 590 && !this->bAttached)
{
	CameraBoom->AttachTo(RootComponent);
}

It’s just the way I wanted when you get close to the wall, however when I attach the CameraBoom (which is the SpringArmComponent) back into my Actor, the camera just bounces off to a completely wrong location. I’ve tried dettaching the SideViewCamera and reattaching it, but the problem persists. Any ideas?

Okay, got it working, I just added a few more arguments to the AttachTo function and it’s working like a charm :slight_smile:

Good to know :slight_smile: Please mark the answer as correct and upvote if you’ve found it helpful :slight_smile:

Ran into some problems when jumping whilst making the transitioning, I’m gonna find a way to get it working.