Strange outcome from APlayerController::GetInputMouseDelta

APlayerController::GetInputMouseDelta doesn’t behave the way I expected it to, so I must have some misconceptions about it. Would you please help me clear it up?

Here’s what I tried. I have the following in my AActor::Tick:

APlayerController* controller = UGameplayStatics::GetPlayerController(GetWorld(), 0);
static float totalDx = 0;
float dx, dy;
controller->GetInputMouseDelta(dx, dy);
totalDx += dx;

I then dragged my cursor from the left edge of my viewport to the right edge of it, and compared the change in the values of totalDx. I expected the difference to be something like my viewport size (1144), but it is instead around 60 and fluctuates each time I tried it.

Hi there! In fact controller->GetInputMouseDelta(dx, dy) refers to this method

float UPlayerInput::GetKeyValue( FKey InKey ) const
{
	UE_CLOG(InKey == EKeys::AnyKey, LogInput, Warning, TEXT("GetKeyValue cannot return a meaningful result for AnyKey"));
	FKeyState const* const KeyState = KeyStateMap.Find(InKey);
	return KeyState ? KeyState->Value.X : 0.f;
}

It is connected to Input Axis logic and Player Input, and has nothing to do with vieport.

Oh wow. Ok. Thank you very much! This clears it up.

I got confused because APlayerController::GetMousePosition outputs viewport coordinates. I thought GetInputMouseDelta was related enough that it’d use the same units of measurement. Now I see that it doesn’t.