Mouse wheel input not working in Axis Mapping?

The input from Mouse Wheel Up/Down doesn’t seem to work at all in my PlayerController class.
I made it so it constantly prints its value , and the Mouse Wheel Up/Down it’s the only case which the input is not received.
I tried to
-Change the input to keyboard and it worked
-Change the input to left/right mouse click and it worked
-Have an Action Mapping that print a string everytime the Mouse Wheel is scrolled and it worked
-My Mouse’s wheel is not broken

here is the code with the different functions

ARTSPlayerController::ARTSPlayerController()
{
	bEnableClickEvents = true;
	bShowMouseCursor = true;
	bEnableTouchEvents = true;
}

void ARTSPlayerController::SetupInputComponent() {
	Super::SetupInputComponent();
	this->InputComponent->BindAction("Move", IE_Pressed,this, &ARTSPlayerController::Move);
	this->InputComponent->BindAxis("Wheel", this, &ARTSPlayerController::Wheel);

}

void ARTSPlayerController::Move() {

	if (GEngine) {
		GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("found"));
	}
}

void ARTSPlayerController::Wheel(float Value) {

	if (GEngine) {
		GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("value: %f"),Value));
	}

}

And it just prints 0.00000 even when i scroll up or down w

Try this in the Input project settings

257835-2018-10-27-06-54-05-window.png

The code is set up correctly, make sure you have your project settings updated.

Edit → Project Settings → Engine → Input

  1. Add to Axis Mappings
  2. Name as “Wheel”
  3. Mouse Wheel Axis = 1.0

I just tested your code with this settings and it worked.

1 Like

I believe we want the Mouse Wheel Axis = 1.0 because of “when I scroll up or down” from the OP.

1 Like

I just found out that it’s all working as intended : it’s not possible to assign the mouse wheel scrolling action to a regular axis mapping as you would do with two different keys.

To be clear, you need to use “Mouse Wheel Axis” and not “Mouse Wheel Up/Down”.

I hope that helps others, it took me a minute to understand what happened in this question and answer. The marked answer is confusing, when it should simply state what I just said.

4 Likes