Enhanced Input problems moving up/down

Hi

Developing a game simulating ROV (underwater) exploring a wreck. All Is fine but whatever I do it does not move up or down (using enhanced input system. Spent hours trying to figure it out. Version 5.5.1. Also please suggest input settings.

... redacted


DEFINE_LOG_CATEGORY(LogCharacter);

// Sets default values
AMyROVCharacter::AMyROVCharacter()
{
	// Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;
	
	// Don't rotate when the controller rotates. Let that just affect the camera.
	bUseControllerRotationPitch = false;
	bUseControllerRotationYaw = false;
	bUseControllerRotationRoll = false;

	// Configure character movement
	GetCharacterMovement()->bOrientRotationToMovement = true; // Character moves in the direction of input...	
	GetCharacterMovement()->RotationRate = FRotator(0.0f, 500.0f, 0.0f); // ...at this rotation rate

	// Note: For faster iteration times these variables, and many more, can be tweaked in the Character Blueprint
	// instead of recompiling to adjust them
	GetCharacterMovement()->AirControl = 0.35f;
	GetCharacterMovement()->MaxWalkSpeed = 500.f;
	GetCharacterMovement()->MinAnalogWalkSpeed = 20.f;
	GetCharacterMovement()->BrakingDecelerationWalking = 2000.f;
	GetCharacterMovement()->BrakingDecelerationFalling = 1500.0f;

	// Create a camera boom (pulls in towards the player if there is a collision)
	CameraBoom = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraBoom"));
	CameraBoom->SetupAttachment(RootComponent);
	CameraBoom->TargetArmLength = 400.0f; // The camera follows at this distance behind the character	
	CameraBoom->bUsePawnControlRotation = true; // Rotate the arm based on the controller

	// Create a follow camera
	FollowCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("FollowCamera"));
	FollowCamera->SetupAttachment(CameraBoom, USpringArmComponent::SocketName); // Attach the camera to the end of the boom and let the boom adjust to match the controller orientation
	FollowCamera->bUsePawnControlRotation = true; // Camera does not rotate relative to arm

}

// Called when the game starts or when spawned
void AMyROVCharacter::BeginPlay()
{
	Super::BeginPlay();
	UEnhancedInputLocalPlayerSubsystem* LocalPlayerSubsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalViewingPlayerController()->GetLocalPlayer());
	LocalPlayerSubsystem->AddMappingContext(DefaultMappingContext, 1);
	if (APlayerController* PlayerController = GetWorld()->GetFirstPlayerController())
	{
		// Let the Player Controller possess this Pawn
		PlayerController->Possess(this);
	}
	GetCharacterMovement()->SetMovementMode(MOVE_Swimming);
	GetCharacterMovement()->GravityScale = 0.0f;
	SetActorEnableCollision(false);

}

// Called every frame
void AMyROVCharacter::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);
}

// Called to bind functionality to input
void AMyROVCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
	// Set up action bindings
	if (UEnhancedInputComponent* EnhancedInputComponent = Cast<UEnhancedInputComponent>(PlayerInputComponent)) {
		
		// Moving
		EnhancedInputComponent->BindAction(IA_MoveAction, ETriggerEvent::Triggered, this, &AMyROVCharacter::Move);

		// Looking
		EnhancedInputComponent->BindAction(IA_LookAction, ETriggerEvent::Triggered, this, &AMyROVCharacter::Look);

	}
	else
	{
		UE_LOG(LogCharacter, Error, TEXT("'%s' Failed to find an Enhanced Input component! This template is built to use the Enhanced Input system. If you intend to use the legacy system, then you will need to update this C++ file."), *GetNameSafe(this));
	}	
}

void AMyROVCharacter::NotifyControllerChanged()
{
	APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
	if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(PlayerController->GetLocalPlayer()))
	{
		Subsystem->AddMappingContext(DefaultMappingContext, 0);
	}
}

void AMyROVCharacter::Move(const FInputActionValue& Value)
{
	// input is a Vector
	const FVector MovementVector = Value.Get<FVector>();
	if (MovementVector.IsNearlyZero())
	{
		return; // No movement to process
	}
	if (Controller != nullptr)
	{
		// find out which way is forward
		const FRotator Rotation = Controller->GetControlRotation();
		const FRotator YawRotation(0, Rotation.Yaw, 0);
		UE_LOG(LogCharacter, Log, TEXT("Move Function - X: %f, Y: %f, Z: %f"), MovementVector.X, MovementVector.Y, MovementVector.Z);

		FVector Position = GetActorLocation();
		UE_LOG(LogCharacter, Log, TEXT("Actor Position: X=%f, Y=%f, Z=%f"), Position.X, Position.Y, Position.Z);
		// Apply movement input
		AddMovementInput(MovementVector);// Up/Down
	} else {
		UE_LOG(LogTemp, Error, TEXT("Controller is null"));
	}
}

void AMyROVCharacter::Look(const FInputActionValue& Value)
{
	// input is a Vector
	const FVector LookAxisVector = Value.Get<FVector>();

	if (Controller != nullptr)
	{
		// add yaw and pitch input to controller
		AddControllerYawInput(LookAxisVector.X);
		AddControllerPitchInput(LookAxisVector.Y);
	}
}

float AMyROVCharacter::GetDepth() const
{
	const float ZReference = 0.0f; // Sea level at Z = 0
	FVector ROVLocation = GetActorLocation();
	float CurrentDepth = FMath::Abs(ZReference - ROVLocation.Z) / 100.0f; // Meters
	return  CurrentDepth;
}

FString AMyROVCharacter::GetDepthText() const
{
	return FString::Printf(TEXT("%.2f m"), GetDepth());
}

That’s solved now. Collision detected not working though