How can I set bounds for a SpectatorPawn?

I would like to limit my pawn movement to some bounds (especially z axis) if possible without colliders, by just setting max for x, y, z.

Pawn has input, ignore it if move would exceed limit of Z value. Or better yet ignore moving up if Z is on max limit.

You can also put trigger volume, and hook to its event for pawn leaving volume, but then it may be tricky to move pawn back inside. That moving back is kind of same code for just comparing to Z (or other bounds from above). So trigger volume just doubles code, does not help really.

1 Like

(post deleted by author)

Pawn has input, ignore it if move would exceed limit of Z value

void ABasePawn::MoveUp_World(const float Val)
{
    if (Val != 0.f)
    {
        if (const float CurrentZ = GetActorLocation().Z; Val > 0.f && CurrentZ >= 25000.f)
        {
            return;
        }
        AddMovementInput(FVector::UpVector, Val);
    }
}

I guess this works for now. thanks!